:root {
  --navy: #1F3A5F;
  --navy-dark: #16294a;
  --navy-deep: #0f1d33;
  --gold: #B8860B;
  --gold-light: #F9BE19;
  --bg: #eef1f7;
  --card: #ffffff;
  --text: #1d2733;
  --muted: #6b7686;
  --border: #dfe5ee;
  --green: #2E7D32;
  --wa: #25D366;
  --red: #c0392b;
  --shadow: 0 4px 18px rgba(20, 35, 60, .08);
  --shadow-lg: 0 14px 40px rgba(20, 35, 60, .16);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', Arial, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; margin-top: 8px; }
.error { color: var(--red); margin-top: 10px; font-size: 14px; }
.w-full { width: 100%; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c3cddc; border-radius: 99px; }
::-webkit-scrollbar-track { background: transparent; }

/* LOGIN */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 700px at 20% -10%, #2c5078 0%, var(--navy) 45%, var(--navy-deep) 100%); }
.login-card { background: var(--card); border-radius: 18px; padding: 40px 36px; width: 390px;
  box-shadow: 0 30px 80px rgba(0,0,0,.45); text-align: center; }
.login-logo { width: 90px; height: 90px; border-radius: 18px; margin-bottom: 12px; box-shadow: 0 8px 24px rgba(31,58,95,.35); }
.login-card h1 { color: var(--navy); letter-spacing: 2px; font-size: 30px; }
.login-sub { color: var(--muted); margin-bottom: 24px; font-size: 13.5px; }
.login-card form { text-align: left; }

/* FORM */
label { display: block; font-size: 12.5px; font-weight: 700; color: var(--navy); margin: 12px 0 4px; letter-spacing: .2px; }
input, select, textarea { width: 100%; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 10px;
  font-size: 14px; font-family: inherit; background: #fbfcfe; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(31,58,95,.14); background: #fff; }
.btn { border: none; border-radius: 10px; padding: 11px 18px; font-size: 14px; font-weight: 700; cursor: pointer; transition: transform .12s, box-shadow .12s, background .15s; }
.btn:active { transform: scale(.97); }
.btn-gold { background: linear-gradient(135deg, var(--gold-light) -40%, var(--gold) 60%); color: #fff; margin-top: 16px; box-shadow: 0 4px 14px rgba(184,134,11,.35); }
.btn-gold:hover { box-shadow: 0 6px 20px rgba(184,134,11,.5); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; background: var(--navy); color: #fff; margin: 1px 2px; border: none; cursor: pointer; }
.btn-sm:hover { background: var(--navy-dark); }
.btn-sm.danger { background: #e8edf5; color: var(--red); }
.btn-sm.danger:hover { background: #fbd9d3; }
.btn-sm.wa { background: var(--wa); }
.btn-sm.wa:hover { background: #1da851; }
.btn-link { background: none; border: none; color: var(--gold-light); cursor: pointer; font-size: 13px; text-decoration: underline; }
.btn-x { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--muted); }

/* APP LAYOUT */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 238px; background: linear-gradient(180deg, var(--navy-dark) 0%, var(--navy-deep) 100%); color: #fff;
  display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 11px; padding: 20px 16px; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand img { width: 44px; height: 44px; border-radius: 11px; box-shadow: 0 4px 12px rgba(0,0,0,.4); }
.brand strong { display: block; font-size: 18px; letter-spacing: 1px; }
.brand span { font-size: 11px; color: #8fa3c0; letter-spacing: .5px; }
.sidebar nav { flex: 1; padding: 16px 10px; }
.sidebar nav a { display: block; color: #c7d3e4; text-decoration: none; padding: 11px 14px; font-size: 14px;
  border-radius: 10px; margin-bottom: 3px; transition: background .15s, color .15s; }
.sidebar nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar nav a.active { background: linear-gradient(90deg, rgba(249,190,25,.18), rgba(249,190,25,.04));
  color: #fff; font-weight: 700; box-shadow: inset 3px 0 0 var(--gold-light); }
.sidebar nav a.ext { color: var(--gold-light); margin-top: 10px; border-top: 1px dashed rgba(255,255,255,.15); border-radius: 0 0 10px 10px; padding-top: 14px; }
.sidebar-footer { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.1); font-size: 13px; color: #8fa3c0; display: flex; flex-direction: column; gap: 6px; }
.main { flex: 1; margin-left: 238px; padding: 28px 32px; }

.section h2 { color: var(--navy); margin-bottom: 18px; font-size: 24px; letter-spacing: .2px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.sec-head h2 { margin: 0; }
.sec-actions { display: flex; gap: 10px; align-items: center; }
.sec-actions input[type="search"] { width: 270px; }
.sec-actions .btn { margin-top: 0; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card h3 { color: var(--navy); font-size: 15px; margin-bottom: 14px; border-bottom: 2px solid var(--gold); padding-bottom: 6px; display: inline-block; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 1000px) { .grid-2 { grid-template-columns: 1fr; } .main { padding: 16px; } }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow);
  position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: linear-gradient(180deg, var(--gold-light), var(--gold)); }
.kpi .ico { position: absolute; right: 10px; top: 8px; font-size: 30px; opacity: .14; }
.kpi .num { font-size: 30px; font-weight: 800; color: var(--navy); }
.kpi .lbl { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; font-weight: 600; }

/* TABLES */
.table-wrap { overflow-x: auto; padding: 0; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { background: var(--navy); color: #fff; text-align: left; padding: 11px 14px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; }
th:first-child { border-top-left-radius: 14px; }
th:last-child { border-top-right-radius: 14px; }
td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: #f6f9fd; }
.thumb { width: 58px; height: 42px; object-fit: cover; border-radius: 8px; box-shadow: 0 2px 6px rgba(0,0,0,.18); vertical-align: middle; }
.thumb-empty { display: inline-flex; width: 58px; height: 42px; border-radius: 8px; background: #e8edf5; align-items: center; justify-content: center; color: #9aa7ba; }

/* TAGS */
.tag { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; background: #e8edf5; color: var(--navy); }
.tag.captacion { background:#fff3cd; color:#7a5c00; }
.tag.exclusividad { background:#ffe5b4; color:#8a4b00; }
.tag.publicada { background:#d7e8ff; color:#114488; }
.tag.visitas { background:#e2d9f7; color:#4b2e83; }
.tag.negociacion { background:#ffe1ee; color:#9b1859; }
.tag.reservada { background:#d2f4dd; color:#1c6b34; }
.tag.vendida { background:#c8e6c9; color:#1b5e20; }
.tag.descartada { background:#eeeeee; color:#777; }
.tag.pendiente { background:#fff3cd; color:#7a5c00; }
.tag.realizada { background:#d2f4dd; color:#1c6b34; }
.tag.cancelada { background:#fbd9d3; color:#a02a14; }

/* KANBAN */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; }
.kcol { background: #e7ecf4; border-radius: 14px; padding: 10px; min-width: 200px; flex: 1; }
.kcol h4 { font-size: 11.5px; text-transform: uppercase; color: var(--navy); padding: 4px 6px 10px; letter-spacing: .7px; }
.kcol h4 .count { float: right; background: var(--navy); color: #fff; border-radius: 99px; padding: 1px 8px; font-size: 11px; }
.kcard { background: #fff; border: 1px solid var(--border); border-radius: 11px; margin-bottom: 9px; cursor: grab;
  box-shadow: 0 2px 6px rgba(20,35,60,.08); overflow: hidden; transition: transform .12s, box-shadow .12s; }
.kcard:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(20,35,60,.16); }
.kcard .kimg { height: 84px; background: center/cover no-repeat; }
.kcard .kpad { padding: 9px 11px; }
.kcard strong { display: block; font-size: 13px; color: var(--navy); }
.kcard .meta { font-size: 12px; color: var(--muted); display: block; }
.kcard .precio { font-size: 13px; font-weight: 800; color: var(--gold); }
.kcol.dragover { outline: 2px dashed var(--gold); outline-offset: -4px; }

/* DASH LISTS */
.mini-item { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; gap: 8px; }
.mini-item:last-child { border-bottom: none; }
.funnel-bars { display: flex; flex-direction: column; gap: 9px; }
.fbar { display: flex; align-items: center; gap: 10px; }
.fbar .flbl { width: 112px; font-size: 12px; color: var(--muted); font-weight: 600; }
.fbar .fbg { flex: 1; background: #e7ecf4; height: 22px; border-radius: 99px; overflow: hidden; }
.fbar .ffill { height: 100%; background: linear-gradient(90deg, var(--navy) 0%, #38659c 60%, var(--gold) 130%); border-radius: 99px; min-width: 5px; transition: width .5s; }
.fbar .fnum { width: 32px; text-align: right; font-weight: 800; color: var(--navy); }

/* FOTOS */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin: 10px 0; }
.photo-item { position: relative; border-radius: 10px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.photo-item img { width: 100%; height: 82px; object-fit: cover; display: block; }
.photo-item button { position: absolute; top: 5px; right: 5px; background: rgba(0,0,0,.55); color: #fff; border: none;
  border-radius: 99px; width: 22px; height: 22px; font-size: 12px; cursor: pointer; }
.photo-item button:hover { background: var(--red); }
.upload-zone { border: 2px dashed var(--border); border-radius: 12px; padding: 16px; text-align: center; color: var(--muted);
  font-size: 13px; cursor: pointer; transition: border-color .15s, background .15s; margin-top: 8px; }
.upload-zone:hover { border-color: var(--gold); background: #fffbf0; }

/* ARCHIVOS / MEDIA */
.media-actions { display: flex; gap: 10px; margin: 10px 0; flex-wrap: wrap; }
.btn-up { flex: 1; min-width: 180px; border: 2px dashed var(--border); background: #fbfcfe; border-radius: 12px;
  padding: 13px 14px; font-size: 13.5px; font-weight: 700; color: var(--navy); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px; transition: border-color .15s, background .15s; }
.btn-up small { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.btn-up:hover { border-color: var(--gold); background: #fffbf0; }
.file-row { display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; margin-top: 7px; font-size: 13.5px; background: #fbfcfe; }
.file-row .btn-sm { text-decoration: none; }
.aviso-ok { background: #d2f4dd; color: #1c6b34; border-radius: 10px; padding: 11px 14px; font-size: 13.5px;
  font-weight: 600; margin-bottom: 12px; }

/* MODAL */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10,18,32,.6); backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 50; overflow-y: auto; }
.modal { background: #fff; border-radius: 18px; width: 660px; max-width: 100%; padding: 24px 26px; box-shadow: var(--shadow-lg); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.modal-head h3 { color: var(--navy); font-size: 19px; }
.modal h3.sub { color: var(--navy); font-size: 14px; margin-top: 16px; border-bottom: 2px solid var(--gold); display: inline-block; padding-bottom: 4px; }
.modal .row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.modal .row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 14px; }
@media (max-width: 640px) { .modal .row, .modal .row3 { grid-template-columns: 1fr; } }

/* REPORTES */
.rep-row { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.rep-row > div { flex: 1; min-width: 160px; }
.rep-row .btn { margin-top: 0; white-space: nowrap; }

/* REPORTERÍA */
.sec-actions select { width: auto; min-width: 150px; }
#rv-stamp { text-align: right; }

/* BIBLIOTECA */
.bib-crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; font-size: 14px; }
.bib-crumbs a { color: var(--navy); text-decoration: none; font-weight: 600; padding: 4px 10px; border-radius: 8px; background: #e8edf5; }
.bib-crumbs a:hover { background: #dbe3ef; }
.bib-crumbs .cur { color: var(--muted); font-weight: 600; }
.bib-crumbs .sep { color: var(--muted); }

.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.folder-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 18px 16px;
  box-shadow: var(--shadow); cursor: pointer; text-align: left; transition: transform .12s, box-shadow .12s; }
.folder-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--gold); }
.folder-ico { font-size: 30px; margin-bottom: 8px; }
.folder-name { font-weight: 700; color: var(--navy); font-size: 14.5px; line-height: 1.25; }
.folder-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.folder-meta { font-size: 12px; color: var(--muted); margin-top: 8px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.bib-venta-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.doc-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 14px; box-shadow: var(--shadow);
  cursor: pointer; text-align: center; text-decoration: none; color: var(--text); display: block; transition: transform .12s, box-shadow .12s; }
.doc-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--gold); }
.doc-card.gen { cursor: default; opacity: .8; }
.doc-card.gen:hover { transform: none; box-shadow: var(--shadow); border-color: var(--border); }
.doc-ico { font-size: 38px; line-height: 1; margin: 6px 0 10px; }
.doc-thumb { height: 90px; border-radius: 8px; background: #e8edf5 center/cover no-repeat; margin-bottom: 10px; }
.doc-name { font-size: 13px; font-weight: 600; color: var(--navy); word-break: break-word; line-height: 1.25; }
.doc-meta { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
