@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,700;1,9..40,400;1,9..40,500&family=JetBrains+Mono:wght@400;500;700&display=swap');

/*
  ENDE studio · identidad Corporativa (ende-proposal)
  cream/ink/orange · DM Sans + Bebas Neue + JetBrains Mono
  Nota: los nombres de variable son heredados; --cream = texto ink, --ink = superficie de campo.
*/
:root {
    --bg: #f4f2ec;        /* fondo crema de la app */
    --paper: #ffffff;     /* tarjetas / superficies */
    --ink: #ffffff;       /* superficie de campos (inputs) */
    --panel: #ffffff;
    --panel-2: #ece8dd;   /* hover / activo (crema más oscuro) */
    --line: #d8d4c8;
    --cream: #111111;     /* color de TEXTO (ink) */
    --muted: #6b675e;
    --orange: #F39325;
    --blue: #008ECF;
    --red: #d62828;
    --acid: #cdff3a;
    --radius: 12px;
    --mono: 'JetBrains Mono', ui-monospace, monospace;
    --sans: 'DM Sans', system-ui, sans-serif;
    --display: 'Bebas Neue', sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--cream);
    font-family: var(--sans);
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; }

/* ── Topbar ─────────────────────────────── */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 32px; border-bottom: 1px solid var(--line);
    position: sticky; top: 0; background: rgba(244,242,236,.9);
    backdrop-filter: blur(8px); z-index: 10;
}
.brand { display: flex; align-items: baseline; gap: 9px; text-decoration: none; }
.brand img { height: 17px; width: auto; display: block; transform: translateY(2px); }
.brand span, .brand-lg span {
    font-family: var(--mono); font-size: 11px; letter-spacing: .18em;
    text-transform: uppercase; color: var(--orange);
}
.topbar-right { display: flex; align-items: center; gap: 14px; }
.who { color: var(--muted); font-size: 13px; font-family: var(--mono); letter-spacing: .02em; }

/* ── Layout ─────────────────────────────── */
.wrap { max-width: 1080px; margin: 0 auto; padding: 44px 32px 90px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 30px; gap: 20px; }
h1 { font-size: 34px; margin: 0; font-weight: 500; letter-spacing: -.025em; }
h2 { font-size: 22px; margin: 0 0 4px; font-weight: 500; letter-spacing: -.02em; }
h3 { font-size: 19px; margin: 0 0 2px; font-weight: 500; letter-spacing: -.015em; }
.muted { color: var(--muted); }
p { line-height: 1.55; }

/* ── Botones ────────────────────────────── */
.btn, .btn-sm {
    background: var(--orange); color: #221200; border: none; cursor: pointer;
    font-family: inherit; font-weight: 700; border-radius: 9px;
    padding: 11px 18px; font-size: 15px; text-decoration: none; display: inline-block;
    transition: transform .08s ease, filter .15s ease; letter-spacing: -.01em;
}
.btn:hover, .btn-sm:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 8px 13px; font-size: 13px; }
.btn-sm.ghost, .btn-ghost {
    background: transparent; color: var(--cream); border: 1px solid var(--line); font-weight: 500;
}
.btn-ghost { padding: 9px 15px; border-radius: 9px; font-size: 13px; font-family: var(--mono);
    letter-spacing: .04em; text-decoration: none; cursor: pointer; }
.btn-ghost:hover, .btn-sm.ghost:hover { border-color: var(--cream); filter: none; }
.btn-sm.danger { background: transparent; color: var(--red); border: 1px solid #e3c4c4; }
.btn-sm.danger:hover { background: #fbeaea; filter: none; }

/* ── Grid de proyectos ──────────────────── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.card {
    background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 20px; display: flex; flex-direction: column; gap: 10px;
}
.card.is-new { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(243,147,37,.18); }
.card-top { display: flex; align-items: center; justify-content: space-between; }
.badge { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .12em;
    padding: 4px 8px; border-radius: 5px; font-weight: 500; }
.badge-dreamy { background: #1a0e26; color: var(--acid); }
.badge-corporate { background: rgba(243,147,37,.16); color: #b5651a; }
.badge-external { background: rgba(0,142,207,.14); color: var(--blue); }
.badge-private  { background: rgba(200,50,50,.12); color: #b03030; }
.badge-delivered{ background: rgba(28,75,134,.12); color: #1c4b86; }
.badge-editing  { background: rgba(243,147,37,.16); color: #9a5b12;
    border: 1px solid rgba(243,147,37,.45); cursor: help; white-space: nowrap; }

/* ── Dashboard: lista de presentaciones ─────────────────────── */
.plist { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.prow {
    display: grid; grid-template-columns: 96px minmax(0,1fr) auto auto;
    gap: 16px; align-items: center;
    padding: 14px 6px; border-bottom: 1px solid var(--line);
    transition: background .12s;
}
.prow:hover { background: rgba(0,0,0,.03); }
.prow-plain { grid-template-columns: minmax(0,1fr) auto; }   /* filas sin miniatura (respaldos) */
.prow.is-new { background: rgba(243,147,37,.07); }
.pthumb {
    width: 96px; height: 60px; border-radius: 8px; overflow: hidden; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--panel, #eee); border: 1px solid var(--line);
    font-family: var(--mono); font-size: 15px; letter-spacing: .08em; color: var(--muted);
    text-decoration: none;
}
.pthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pthumb.dreamy    { background: #14101d; color: #b3ff00; }
.pthumb.corporate { background: rgba(243,147,37,.14); color: #b5651a; }
.pmain { min-width: 0; }
.pmain h3 { margin: 0 0 4px; font-size: 17px; display: flex; align-items: center; gap: 8px; min-width: 0; }
.pmain h3 a { color: inherit; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pmain h3 a:hover { text-decoration: underline; }
.pmeta { margin: 0; font-size: 12.5px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pmeta .cli-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pacts { display: flex; align-items: center; gap: 8px; }
.pmore { position: relative; }
.pmore summary {
    list-style: none; cursor: pointer; user-select: none;
    padding: 4px 10px; border-radius: 8px; border: 1px solid var(--line);
    font-size: 16px; line-height: 1; color: var(--muted);
}
.pmore summary::-webkit-details-marker { display: none; }
.pmore summary:hover { background: rgba(0,0,0,.05); }
.pmore[open] summary { background: rgba(0,0,0,.06); }
.pmenu {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
    background: #fff; border: 1px solid var(--line); border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,.12);
    min-width: 170px; padding: 6px; display: flex; flex-direction: column;
}
.pmenu form { margin: 0; }
.pmenu button {
    display: block; width: 100%; text-align: left; background: none; border: 0;
    padding: 8px 10px; border-radius: 7px; font-size: 13.5px; cursor: pointer;
    font-family: var(--sans); color: var(--cream, #222); /* OJO: --cream es el color de TEXTO en esta paleta */
}
.pmenu button:hover { background: rgba(0,0,0,.06); }
.pmenu button.danger { color: #b03030; }
.pmenu button.danger:hover { background: rgba(200,50,50,.08); }
@media (max-width: 720px) {
    .prow { grid-template-columns: 64px minmax(0,1fr) auto; }
    .prow .status { display: none; }
    .pthumb { width: 64px; height: 44px; }
    .pacts .btn-sm.ghost { display: none; }
}
.status { font-family: var(--mono); font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.status.on { color: #2e7d32; }

.url-row { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.url {
    flex: 1; background: var(--bg); border: 1px solid var(--line); color: var(--muted);
    border-radius: 7px; padding: 8px 10px; font-family: var(--mono); font-size: 12px; min-width: 0;
}
.card-actions { display: flex; gap: 8px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.card-actions form { margin: 0; }
.card-actions form:last-child { margin-left: auto; }
.card-foot { font-family: var(--mono); font-size: 11px; letter-spacing: .03em; margin-top: 2px; color: var(--muted); }

/* ── Empty state ────────────────────────── */
.empty { text-align: center; padding: 64px 20px; border: 1px dashed var(--line);
    border-radius: var(--radius); display: flex; flex-direction: column; gap: 14px; align-items: center;
    background: var(--paper); }

/* ── Formularios ────────────────────────── */
.stack { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; }
input[type=text], input[type=password], textarea, select {
    background: var(--paper); border: 1px solid var(--line); color: var(--cream);
    border-radius: 8px; padding: 12px 14px; font-family: inherit; font-size: 15px;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--orange); }
::placeholder { color: #b3ae9f; }
.alert.ok { background: #eaf6ec; border-color: #c2e0c8; color: #256b31; }
.alert { background: #fbeaea; border: 1px solid #e3c4c4; color: #a12626;
    padding: 12px 14px; border-radius: 9px; margin-bottom: 18px; font-size: 14px; }

/* ── Radios de estilo ───────────────────── */
.style-pick { border: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.style-pick legend { font-size: 14px; font-weight: 500; margin-bottom: 6px; padding: 0; }
.radio { flex-direction: row; align-items: flex-start; gap: 10px; border: 1px solid var(--line);
    padding: 12px 14px; border-radius: 9px; cursor: pointer; background: var(--paper); }
.radio:has(input:checked) { border-color: var(--orange); background: #fdf4e8; }
.radio input { margin-top: 3px; accent-color: var(--orange); }

/* ── Modal ──────────────────────────────── */
.modal { border: 1px solid var(--line); background: var(--paper); color: var(--cream);
    border-radius: var(--radius); padding: 26px; width: min(440px, 92vw); }
.modal::backdrop { background: rgba(17,17,17,.4); backdrop-filter: blur(2px); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

/* ── Login ──────────────────────────────── */
.login-box { max-width: 360px; margin: 15vh auto 0; text-align: center; }
.login-box .brand-lg { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.login-box .brand-lg img { height: 34px; width: auto; }
.brand-lg span { display: block; }
.login-box .stack { margin-top: 26px; text-align: left; }
.login-box .btn { margin-top: 6px; }

/* ── Vista pública placeholder (cliente) ── */
.public-body { display: grid; place-items: center; min-height: 100vh; padding: 24px; text-align: center; }
.public-body.style-dreamy { background: #140b1f; color: #f4f0e6; }
.public-body.style-corporate, .public-body { background: var(--bg); color: var(--cream); }
.public-card { max-width: 640px; }
.public-card h1 { font-size: clamp(34px, 7vw, 64px); letter-spacing: -.03em; margin: 12px 0; font-weight: 500; }
.public-card .eyebrow { font-family: var(--mono); text-transform: uppercase; letter-spacing: .18em;
    font-size: 12px; color: var(--orange); }
.style-dreamy .public-card .eyebrow { color: var(--acid); }

/* ── Cliente editable en la tarjeta del dashboard ── */
.card-client { display: flex; align-items: center; gap: 8px; }
.card-client .cli-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-client .nocli { opacity: .55; font-style: italic; }
.cli-edit { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px;
    padding: 2px 5px; border-radius: 5px; line-height: 1; flex-shrink: 0; }
.cli-edit:hover { color: var(--orange); background: var(--panel-2); }

/* ── Wireframes de formato (#6) ──────────── */
.wf { width: 100%; height: auto; display: block; color: var(--cream); }
.wf-frame { fill: none; stroke: var(--line); stroke-width: 1.5; }
.wf-t { fill: currentColor; opacity: .80; }         /* título / valor */
.wf-b { fill: currentColor; opacity: .26; }         /* cuerpo / líneas */
.wf-e { fill: var(--orange); }                       /* eyebrow / acento */
.wf-n { fill: currentColor; opacity: .12; }          /* número grande (divisor) */
.wf-m { fill: currentColor; opacity: .09; stroke: var(--line); stroke-width: 1; }  /* caja de media */
.wf-mi { stroke: currentColor; opacity: .38; stroke-width: 1.4; }                  /* icono de media */
.wf-dark { fill: currentColor; opacity: .14; }       /* fondo oscuro (cierre) */

/* Galería de formatos (formats.php) */
.fmt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-top: 8px; }
.fmt-group-title { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .14em;
    color: var(--muted); margin: 26px 0 4px; grid-column: 1 / -1; }
.fmt-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.fmt-card .wf-holder { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.fmt-card h3 { margin: 0; font-size: 15px; font-weight: 700; }
.fmt-card p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.4; }
.fmt-card .fmt-key { font-family: var(--mono); font-size: 10px; color: var(--muted); letter-spacing: .05em; }

@media (max-width: 620px) {
    .page-head { flex-direction: column; align-items: stretch; }
    .wrap { padding: 28px 18px 60px; }
    .topbar { padding: 14px 18px; }
}

/* Pestañas de estado del dashboard */
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tab { text-decoration: none; padding: 7px 14px; border-radius: 999px; font-size: 13px;
    color: var(--muted); border: 1px solid transparent; }
.tab:hover { background: rgba(0,0,0,.04); }
.tab.on { background: var(--cream); color: #fff; }
.tabs-group { display: flex; gap: 6px; }
.tabs-sep { width: 1px; background: rgba(0,0,0,.12); margin: 4px 8px; }
.tab-n { font-family: var(--mono); font-size: 11px; opacity: .7; margin-left: 3px; }
