/* Panel del equipo de HUMAN-IA Studios. Misma paleta y tipografía que la app:
   tinta cálida, papel, dorado y la Fraunces para los titulares. */
@font-face { font-family: Fraunces; src: url('/admin/fonts/Fraunces.ttf') format('truetype'); font-weight: 100 900; font-display: swap; }

:root {
  --ink: #141311; --ink-2: #1a1916; --panel: #201e1a; --panel-2: #29261f;
  --paper: #f7efe0; --muted: #c7baaa; --faint: #8f8475; --line: #3a342c; --line-2: #51473c;
  --gold: #f6bd79; --gold-ink: #241606; --green: #b7dbc6; --green-bg: #1d2a23; --red: #ff9b8f; --red-bg: #33201d;
  --blue: #b9cdf0; --blue-bg: #1e2433;
  --radius: 16px; --radius-sm: 10px;
  --serif: Fraunces, Georgia, 'Times New Roman', serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark; font-family: var(--sans); color: var(--paper); background: var(--ink);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--ink); font-size: 15px; line-height: 1.5; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.02em; line-height: 1.1; margin: 0; }
h1 { font-size: clamp(1.9rem, 3vw, 2.6rem); }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.1rem; }
p { margin: 0; }
a { color: var(--gold); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.eyebrow { text-transform: uppercase; letter-spacing: .16em; font-size: .72rem; font-weight: 800; color: var(--gold); }
.muted { color: var(--muted); }
.faint { color: var(--faint); font-size: .88rem; }
.mark { font-size: 26px; color: var(--gold); line-height: 1; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }

/* Controles */
label { display: grid; gap: 6px; font-weight: 600; font-size: .9rem; color: var(--muted); }
input, textarea, select {
  width: 100%; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--ink-2);
  padding: 10px 12px; color: var(--paper); font: inherit; font-weight: 400; min-height: 42px;
}
textarea { resize: vertical; min-height: 90px; line-height: 1.45; }
input:focus, textarea:focus, select:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px #f6bd7922; }
select {
  appearance: none; padding-right: 34px;
  background: linear-gradient(45deg, transparent 50%, var(--muted) 50%) calc(100% - 17px) 18px / 6px 6px no-repeat,
              linear-gradient(135deg, var(--muted) 50%, transparent 50%) calc(100% - 11px) 18px / 6px 6px no-repeat, var(--ink-2);
}
.check { display: flex; align-items: center; gap: 10px; color: var(--paper); font-weight: 500; }
.check input { width: 18px; height: 18px; min-height: 0; accent-color: var(--gold); }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px;
  padding: 10px 18px; min-height: 42px; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none;
  background: var(--gold); color: var(--gold-ink); white-space: nowrap;
}
button:hover { filter: brightness(1.06); }
button:disabled { opacity: .55; cursor: default; filter: none; }
button.ghost, .button.ghost { background: transparent; color: var(--paper); border: 1px solid var(--line-2); }
button.ghost:hover { border-color: var(--muted); }
button.quiet { background: transparent; color: var(--muted); padding: 6px 10px; min-height: 34px; }
button.quiet:hover { color: var(--paper); }
button.danger { background: transparent; color: var(--red); border: 1px solid #6b3b35; }
button.small, .button.small { min-height: 34px; padding: 6px 12px; font-size: .86rem; border-radius: 10px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stack { display: grid; gap: 14px; }

/* Chips de estado */
.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 10px; font-size: .78rem; font-weight: 700; letter-spacing: .02em; border: 1px solid var(--line-2); color: var(--muted); white-space: nowrap; }
.chip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.plain::before { display: none; }
.chip[data-tone="gold"] { color: var(--gold); border-color: #6d5233; background: #2a2116; }
.chip[data-tone="green"] { color: var(--green); border-color: #3f5a4b; background: var(--green-bg); }
.chip[data-tone="red"] { color: var(--red); border-color: #6b3b35; background: var(--red-bg); }
.chip[data-tone="blue"] { color: var(--blue); border-color: #3c4a66; background: var(--blue-bg); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }

/* Acceso */
.topbar { height: 64px; display: flex; align-items: center; padding: 0 clamp(18px, 4vw, 40px); border-bottom: 1px solid var(--line); }
.narrow { max-width: 460px; margin: 7vh auto; padding: 0 20px; }
.narrow .card { display: grid; gap: 16px; padding: 28px; }
.narrow form { display: grid; gap: 14px; }
.login-hero { display: grid; gap: 10px; }
.error, #result { color: var(--red); }
.error:empty { display: none; }

/* Estructura */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; padding: 20px 14px; border-right: 1px solid var(--line); background: #171613; }
.sidebar .brand { padding: 4px 10px 18px; }
.sidebar .brand small { display: block; color: var(--faint); font-weight: 500; font-size: .78rem; }
.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 600; }
.nav a:hover { background: var(--panel); color: var(--paper); }
.nav a[aria-current="page"] { background: #2c2519; color: var(--gold); }
.nav .count { margin-left: auto; background: var(--gold); color: var(--gold-ink); border-radius: 999px; font-size: .74rem; padding: 0 8px; font-weight: 800; }
.nav .count:empty { display: none; }
.nav svg, .icon { width: 18px; height: 18px; flex: none; }
.me { margin-top: auto; border-top: 1px solid var(--line); padding: 14px 10px 0; display: grid; gap: 8px; }
.me strong { display: block; font-size: .92rem; }
.me span { color: var(--faint); font-size: .8rem; overflow-wrap: anywhere; }
.content { min-width: 0; padding: 28px clamp(18px, 3.5vw, 44px) 80px; }
.pagehead { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.pagehead .titles { display: grid; gap: 6px; }
.pagehead .spacer { flex: 1; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.toolbar select, .toolbar input { width: auto; min-width: 160px; }
.segmented { display: inline-flex; border: 1px solid var(--line-2); border-radius: 12px; padding: 3px; gap: 2px; background: var(--ink-2); }
.segmented button { background: transparent; color: var(--muted); min-height: 34px; padding: 4px 12px; border-radius: 9px; font-weight: 600; }
.segmented button[aria-pressed="true"] { background: var(--panel-2); color: var(--paper); }
.empty { border: 1px dashed var(--line-2); border-radius: var(--radius); padding: 40px 20px; text-align: center; color: var(--muted); }

/* Solicitudes: lista y detalle */
.inbox { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 18px; align-items: start; }
.list { display: grid; gap: 8px; }
.item { display: grid; gap: 6px; text-align: left; width: 100%; background: var(--panel); color: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; font-weight: 400; min-height: 0; white-space: normal; }
.item:hover { border-color: var(--line-2); filter: none; }
.item[aria-current="true"] { border-color: var(--gold); background: #262118; }
.item .top { display: flex; align-items: center; gap: 8px; }
.item .top .when { margin-left: auto; color: var(--faint); font-size: .8rem; }
.item strong { font-family: var(--serif); font-size: 1.06rem; font-weight: 600; }
.item .who { color: var(--muted); font-size: .86rem; overflow-wrap: anywhere; }
.detail { position: sticky; top: 20px; display: grid; gap: 18px; }
.detail dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 0; }
.detail dt { color: var(--faint); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.detail dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.quote { background: var(--ink-2); border-left: 3px solid var(--line-2); padding: 12px 14px; border-radius: 0 10px 10px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: #2a2116; border: 1px solid #6d5233; color: #f3d6b0; font-size: .9rem; }
.notice.info { background: var(--blue-bg); border-color: #3c4a66; color: var(--blue); }
.notice.ok { background: var(--green-bg); border-color: #3f5a4b; color: var(--green); }
.notice.bad { background: var(--red-bg); border-color: #6b3b35; color: var(--red); }

/* Obras */
.works { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.work { display: grid; grid-template-rows: auto 1fr; overflow: hidden; padding: 0; text-align: left; width: 100%; min-height: 0; background: var(--panel); color: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); font-weight: 400; white-space: normal; }
.work:hover { border-color: var(--line-2); filter: none; transform: translateY(-1px); }
.thumb { aspect-ratio: 16 / 9; background: linear-gradient(135deg, #2a251d, #17150f); position: relative; display: grid; place-items: center; color: var(--faint); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .chip { position: absolute; top: 10px; left: 10px; backdrop-filter: blur(6px); }
.work .body { padding: 14px 16px 16px; display: grid; gap: 8px; align-content: start; }
.work h3 { font-size: 1.15rem; }
.meta { color: var(--muted); font-size: .85rem; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { font-size: .74rem; border-radius: 6px; padding: 2px 7px; background: var(--ink-2); border: 1px solid var(--line); color: var(--faint); }
.badge.on { color: var(--green); border-color: #3f5a4b; }
.badge.warn { color: var(--gold); border-color: #6d5233; }

/* Editor de obra */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; align-items: start; }
.editor > .side { position: sticky; top: 20px; display: grid; gap: 16px; }
.section { display: grid; gap: 16px; }
.section + .section { margin-top: 18px; }
.section > header { display: flex; align-items: baseline; gap: 10px; }
.section > header p { color: var(--faint); font-size: .86rem; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs button { background: transparent; color: var(--muted); border-radius: 10px 10px 0 0; min-height: 38px; padding: 6px 14px; border-bottom: 2px solid transparent; font-weight: 700; }
.tabs button[aria-selected="true"] { color: var(--paper); border-bottom-color: var(--gold); }
.tabs .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); }
.tabs .dot.full { background: var(--green); }
.tabs .dot.part { background: var(--gold); }
.credit { display: grid; grid-template-columns: 170px 1fr auto; gap: 8px; align-items: center; }
.slots { display: grid; gap: 14px; }
.slot { display: grid; grid-template-columns: 150px 1fr; gap: 16px; align-items: center; background: var(--ink-2); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.slot .preview { aspect-ratio: 16 / 9; border-radius: 10px; background: var(--panel-2); overflow: hidden; display: grid; place-items: center; color: var(--faint); }
.slot .preview img, .slot .preview video { width: 100%; height: 100%; object-fit: cover; }
.slot .info { display: grid; gap: 6px; min-width: 0; }
.slot .info .name { overflow-wrap: anywhere; }
.drop { border: 1.5px dashed var(--line-2); border-radius: 14px; padding: 18px; text-align: center; color: var(--muted); display: grid; gap: 8px; justify-items: center; transition: border-color .15s, background .15s; }
.drop.over { border-color: var(--gold); background: #2a2116; }
.drop input[type=file] { display: none; }
.progress { display: grid; gap: 4px; }
.bar { height: 8px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), #ffd9a8); width: 0; transition: width .2s; }
.docs { display: grid; gap: 8px; }
.doc { display: grid; grid-template-columns: auto 1fr 170px auto; gap: 10px; align-items: center; background: var(--ink-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.doc .pdf { width: 34px; height: 40px; border-radius: 6px; background: #3a1f1c; color: #ffb3a8; display: grid; place-items: center; font-size: .66rem; font-weight: 800; }
.doc input { min-height: 36px; padding: 6px 10px; }
.doc select { min-height: 36px; padding-top: 6px; padding-bottom: 6px; background-position: calc(100% - 17px) 15px, calc(100% - 11px) 15px, 0 0; }
.savebar { position: sticky; bottom: 16px; z-index: 5; display: flex; gap: 12px; align-items: center; background: #2a2418f2; border: 1px solid #6d5233; border-radius: 14px; padding: 10px 12px 10px 18px; margin-top: 18px; backdrop-filter: blur(8px); box-shadow: 0 12px 40px #0008; }

/* Vista previa como en la app */
.phone { background: #141311; border: 1px solid var(--line-2); border-radius: 26px; padding: 14px; display: grid; gap: 10px; }
.phone .cover { aspect-ratio: 16 / 10; border-radius: 16px; overflow: hidden; position: relative; background: linear-gradient(135deg, #2a251d, #17150f); }
.phone .cover img { width: 100%; height: 100%; object-fit: cover; }
.phone .cover .shade { position: absolute; inset: 0; background: linear-gradient(transparent 35%, #000c); display: flex; flex-direction: column; justify-content: flex-end; padding: 12px; gap: 4px; }
.phone .cover .shade b { font-family: var(--serif); font-size: 1.25rem; line-height: 1.1; }
.phone .cover .shade span { font-size: .78rem; color: #e9dfcf; }
.phone .cover .tag { position: absolute; top: 8px; left: 8px; background: #000a; border-radius: 6px; padding: 2px 6px; font-size: .68rem; }
.phone p { font-size: .84rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }

/* Equipo y registro */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--faint); font-size: .76rem; text-transform: uppercase; letter-spacing: .08em; }
td .faint { display: block; }
.secret { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; background: var(--ink-2); border: 1px solid var(--line-2); padding: 8px 12px; border-radius: 10px; font-size: 1.05rem; letter-spacing: .03em; user-select: all; }

/* Diálogos y avisos */
dialog { border: 1px solid var(--line-2); border-radius: 18px; background: var(--panel); color: var(--paper); padding: 24px; width: min(460px, calc(100vw - 32px)); }
dialog::backdrop { background: #000a; backdrop-filter: blur(2px); }
dialog form { display: grid; gap: 14px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--paper); color: var(--ink); padding: 10px 18px; border-radius: 12px; font-weight: 700; box-shadow: 0 12px 40px #000a; z-index: 50; max-width: calc(100vw - 32px); }
.toast.bad { background: var(--red); }

@media (max-width: 1100px) {
  .editor { grid-template-columns: 1fr; }
  .editor > .side { position: static; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 10; height: auto; flex-direction: row; align-items: center; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .sidebar .brand { padding: 0 8px 0 0; }
  .sidebar .brand small { display: none; }
  .nav { display: flex; }
  .nav a span.label { display: none; }
  .me { margin: 0 0 0 auto; border: 0; padding: 0; display: flex; }
  .me > div { display: none; }
  .inbox { grid-template-columns: 1fr; }
  .detail { position: static; }
  .slot { grid-template-columns: 1fr; }
  .doc { grid-template-columns: auto 1fr; }
  .credit { grid-template-columns: 1fr; }
}
.gap-top { margin-top: 18px; }
.when-col { width: 190px; }
.item, .work { justify-content: stretch; justify-items: stretch; align-items: stretch; text-decoration: none; }
.work .body, .work h3 { text-decoration: none; }
.me button { justify-content: flex-start; padding-left: 0; }
.segmented { max-width: 100%; overflow-x: auto; }
@media (max-width: 860px) {
  .sidebar .brand > div { display: none; }
  .me #changePassword { display: none; }
  .toolbar select, .toolbar input { flex: 1 1 160px; }
  .pagehead { align-items: center; }
}
