@font-face { font-family: "Bricolage Grotesque"; src: url("/fonts/bricolage-grotesque-latin-wght-normal.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Schibsted Grotesk"; src: url("/fonts/schibsted-grotesk-latin-wght-normal.woff2") format("woff2"); font-weight: 400 900; font-display: swap; }

:root {
  --paper: #F3F4F6; --surface: #FFFFFF; --well: #E9EBF0; --ink: #1E2430; --ink-2: #566074; 
  --line: #DADDE4; --accent: #3347D6; --accent-ink: #FFFFFF; --bad: #C8321A; --ok: #1F8A52;
  --side: #1E2430; --side-ink: #C9CFDB;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Schibsted Grotesk", "Segoe UI", system-ui, sans-serif;
}
:root { --ink-3: #7B8497; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.5 var(--body); }
h1, h2, h3, h4 { font-family: var(--display); margin: 0; letter-spacing: -0.015em; line-height: 1.15; }
h1 { font-size: 34px; font-weight: 700; letter-spacing: -0.025em; }
h2 { font-size: 20px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }

/* ---------- Botones y campos ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 550; text-decoration: none; line-height: 1.2; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #2639BD; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--well); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; }

label.f { display: grid; gap: 5px; font-size: 13px; color: var(--ink-2); font-weight: 550; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); font-weight: 400;
}
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
input:hover, select:hover, textarea:hover { border-color: #BCC1CD; }
input[type=color] { width: 36px; height: 32px; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); cursor: pointer; }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); font-weight: 450; }
.form-err { color: var(--bad); font-size: 13px; min-height: 1em; }
.form { display: grid; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }

/* ---------- Acceso ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(300px, 5fr) 6fr; }
.auth-art { background: var(--side); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.auth-art h1 { font-size: clamp(38px, 5vw, 64px); font-weight: 750; max-width: 10ch; }
.auth-art p { color: var(--side-ink); max-width: 34ch; }
.auth-form { display: grid; place-items: center; padding: 32px; }
.auth-form .form { width: min(380px, 100%); }
.auth-form h2 { font-size: 26px; margin-bottom: 4px; }

/* ---------- Estructura ---------- */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { padding: 22px 20px 16px; font-family: var(--display); font-weight: 750; font-size: 21px; letter-spacing: -0.02em; color: #fff; }
.side nav { display: grid; gap: 2px; padding: 0 10px; }
.side a.nav { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-radius: 6px; text-decoration: none; font-weight: 550; }
.side a.nav:hover { background: rgba(255,255,255,.07); }
.side a.nav.on { background: rgba(255,255,255,.13); color: #fff; }
.side .badge { background: var(--accent); color: #fff; font-size: 12px; border-radius: 10px; padding: 0 7px; line-height: 18px; }
.side-projects { padding: 18px 10px; flex: 1; display: grid; gap: 12px; align-content: start; }
.side-projects .cl { font-weight: 600; font-size: 13px; color: #fff; padding: 0 10px; text-decoration: none; display: block; }
.side-projects .cl:hover { text-decoration: underline; }
.side-projects a.pj { display: block; padding: 4px 10px 4px 22px; border-radius: 6px; text-decoration: none; font-size: 14px; color: var(--side-ink); }
.side-projects a.pj:hover { background: rgba(255,255,255,.07); }
.side-projects a.pj.on { background: rgba(255,255,255,.13); color: #fff; }
.side-foot { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.12); display: flex; align-items: center; gap: 10px; }
.side-foot .who { flex: 1; min-width: 0; line-height: 1.25; }
.side-foot .who b { display: block; color: #fff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .who span { font-size: 12px; }
.side-foot button { background: none; border: 1px solid rgba(255,255,255,.25); color: var(--side-ink); border-radius: 6px; padding: 4px 9px; cursor: pointer; font-size: 13px; }
.side-foot button:hover { color: #fff; border-color: #fff; }
.topbar { display: none; }
main#view { padding: 32px 36px 64px; min-width: 0; max-width: 1500px; }
.page-h { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-h .sub { color: var(--ink-2); margin-top: 6px; max-width: 70ch; }
.crumbs { font-size: 14px; color: var(--ink-2); margin-bottom: 8px; }
.crumbs a { text-decoration: none; } .crumbs a:hover { text-decoration: underline; }
.section { margin-top: 36px; }
.section > h2 { margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }

/* ---------- Espectro de estados ---------- */
.spectrum { display: flex; gap: 2px; height: 10px; border-radius: 3px; overflow: hidden; background: var(--well); min-width: 80px; }
.spectrum i { display: block; min-width: 3px; }
.spectrum.big { height: 22px; border-radius: 4px; }
.spectrum.empty { background: repeating-linear-gradient(135deg, var(--well) 0 6px, #DFE2E8 6px 12px); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 14px; }
.legend span { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.legend b { font-family: var(--display); font-weight: 650; }
.sw { width: 10px; height: 10px; border-radius: 2px; background: var(--c, #999); display: inline-block; flex: none; }

/* ---------- Listas ---------- */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.list > * + * { border-top: 1px solid var(--line); }
.item { display: grid; align-items: center; gap: 16px; padding: 13px 16px; text-decoration: none; }
.item:hover { background: #FAFAFB; }
.item .name { font-weight: 600; }
.item .meta { color: var(--ink-2); font-size: 13px; }
.item.client { grid-template-columns: minmax(160px, 2fr) minmax(120px, 3fr) 150px; }
.item.proj { grid-template-columns: minmax(160px, 2fr) minmax(120px, 3fr) 150px 90px; }
.item.task { grid-template-columns: 12px minmax(0, 1fr) auto auto; cursor: pointer; padding: 10px 16px; }
.item.task .t { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item.task .meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item.dim { opacity: .6; }
.empty-box { padding: 28px 20px; text-align: center; color: var(--ink-2); background: var(--surface); border: 1px dashed #C3C8D3; border-radius: 8px; }
.empty-box p + p, .empty-box p + .btn { margin-top: 10px; }
.due { font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.due.bad { color: var(--bad); font-weight: 600; }
.tag { font-size: 12px; padding: 1px 8px; border-radius: 10px; background: var(--well); color: var(--ink-2); white-space: nowrap; }
.tag.bad { background: #FBE4DF; color: var(--bad); }

.av { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; flex: none; }
.av.none { background: transparent; border: 1.5px dashed #BCC1CD; }
.av.lg { width: 32px; height: 32px; font-size: 13px; }

.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: 14px; }
.feed li { display: grid; gap: 1px; }
.feed time { font-size: 12px; color: var(--ink-3); }
.feed a { text-decoration: none; color: var(--ink-2); } .feed a:hover { text-decoration: underline; }

/* ---------- Tablero ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 20px 0 16px; }
.toolbar input[type=search] { width: 220px; }
.toolbar select { width: auto; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 7px 13px; cursor: pointer; font-weight: 550; color: var(--ink-2); }
.seg button.on { background: var(--ink); color: #fff; }
.board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 14px; align-items: flex-start; }
.col { flex: 0 0 276px; background: var(--well); border-radius: 8px; padding: 12px 10px 10px; }
.col-h { display: flex; align-items: center; gap: 8px; padding: 0 4px 10px; }
.col-h h3 { flex: 1; }
.col-h .n { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.col-body { display: grid; gap: 8px; min-height: 44px; align-content: start; }
.col-body.over { outline: 2px dashed var(--accent); outline-offset: 2px; border-radius: 6px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; cursor: pointer; border-left: 4px solid var(--c, var(--line)); }
.card:hover { border-color: #AEB4C2; border-left-color: var(--c); }
.card.dragging { opacity: .45; }
.card.late { border-color: #EBB8AE; border-left-color: var(--c); }
.card-t { font-weight: 550; line-height: 1.35; overflow-wrap: anywhere; }
.card-m { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.card-m .sp { flex: 1; }
.prio { font-weight: 600; } .prio.hi { color: var(--bad); } .prio.lo { color: var(--ink-3); }
.col-add { width: 100%; margin-top: 8px; padding: 7px; border: 1px dashed #B8BECB; border-radius: 6px; background: transparent; color: var(--ink-2); cursor: pointer; font-weight: 550; }
.col-add:hover { background: rgba(255,255,255,.6); color: var(--ink); }
.quick { display: grid; gap: 6px; margin-top: 8px; }
.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.table th { text-align: left; font-size: 13px; color: var(--ink-2); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #FAFAFB; }
.table td { padding: 8px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.rowlink { cursor: pointer; } .table tr.rowlink:hover td { background: #FAFAFB; }
.table select { padding: 5px 8px; font-size: 14px; }
.scroll-x { overflow-x: auto; }

/* ---------- Diálogos ---------- */
dialog { border: 0; padding: 0; color: var(--ink); background: var(--surface); }
dialog::backdrop { background: rgba(30, 36, 48, .5); }
dialog.modal { width: min(480px, calc(100vw - 24px)); border-radius: 10px; margin: auto; max-height: calc(100vh - 32px); }
dialog.drawer { width: min(580px, 100vw); height: 100vh; max-height: 100vh; margin: 0 0 0 auto; border-radius: 0; animation: slide .18s ease-out; }
@keyframes slide { from { transform: translateX(24px); opacity: .4; } }
.dlg-in { padding: 24px; }
.dlg-in > h2 { margin-bottom: 16px; }
.dr-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.x { border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--ink-2); line-height: 1; padding: 4px 8px; border-radius: 6px; }
.x:hover { background: var(--well); }
.title-in { font: 700 24px/1.2 var(--display); letter-spacing: -0.02em; border: 1px solid transparent !important; padding: 6px 8px !important; margin: 0 -8px 12px; width: calc(100% + 16px) !important; }
.title-in:hover, .title-in:focus { border-color: var(--line) !important; }
.props { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.dr-b h3 { margin: 26px 0 10px; }
.comment { display: grid; grid-template-columns: 32px 1fr; gap: 10px; margin-bottom: 14px; }
.comment p { white-space: pre-wrap; overflow-wrap: anywhere; }
.comment .who { font-size: 13px; color: var(--ink-2); }
.comment .who b { color: var(--ink); }
.linkbtn { background: none; border: 0; padding: 0; color: var(--ink-3); cursor: pointer; font-size: 12px; text-decoration: underline; }
.sharebox { display: grid; gap: 12px; }
.sharebox .url { display: flex; gap: 8px; }

/* ---------- Ajustes y equipo ---------- */
.st-row { display: grid; grid-template-columns: 40px minmax(120px, 1fr) auto auto; gap: 10px; align-items: center; padding: 10px 14px; }
.st-row .btns { display: flex; gap: 4px; }
.st-row .ic { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; cursor: pointer; width: 30px; height: 30px; }
.st-row .ic:hover { border-color: var(--ink-3); }
.st-row .ic:disabled { opacity: .35; cursor: default; }
.user-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 12px 16px; }

/* ---------- Mensajes ---------- */
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 1000; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; }
#toast.err { background: var(--bad); }

/* ---------- Vista pública ---------- */
.pub { max-width: 860px; margin: 0 auto; padding: 40px 20px 72px; }
.pub-top { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-weight: 600; margin-bottom: 36px; font-family: var(--display); }
.pub-top .sw { width: 14px; height: 14px; }
.pub h1 { margin-bottom: 8px; }
.pub .lead { color: var(--ink-2); margin-bottom: 22px; max-width: 62ch; }
.pub .pct { font-family: var(--display); font-weight: 700; font-size: 15px; margin: 18px 0 8px; }
.pub-group { margin-top: 30px; }
.pub-group h3 { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 16px; }
.pub-task { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: 6px; padding: 12px 14px; }
.pub-task + .pub-task { margin-top: 8px; }
.pub-task .d { color: var(--ink-2); margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.pub-task .row { justify-content: space-between; align-items: baseline; }
.pub details { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; margin-top: 12px; }
.pub summary { padding: 16px 18px; cursor: pointer; display: grid; gap: 10px; list-style: none; }
.pub summary::-webkit-details-marker { display: none; }
.pub summary h2 { font-size: 19px; }
.pub details > .inner { padding: 0 18px 18px; }
.pub-foot { margin-top: 48px; color: var(--ink-3); font-size: 13px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; } .auth-art { padding: 28px; gap: 24px; }
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 50; left: 0; top: 0; width: 280px; transform: translateX(-102%); transition: transform .2s; }
  .side.open { transform: none; }
  .topbar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--side); color: #fff; position: sticky; top: 0; z-index: 40; font-family: var(--display); font-weight: 700; font-size: 18px; }
  .topbar button { background: none; border: 1px solid rgba(255,255,255,.3); color: #fff; border-radius: 6px; padding: 5px 10px; cursor: pointer; }
  main#view { padding: 20px 16px 56px; }
  h1 { font-size: 28px; }
  .grid2 { grid-template-columns: 1fr; gap: 0; }
  .item.client, .item.proj { grid-template-columns: 1fr; gap: 8px; }
  .item.task { grid-template-columns: 12px minmax(0, 1fr) auto; } .item.task .due-col { display: none; }
  .col { flex-basis: 252px; }
  .props { grid-template-columns: 1fr; }
  .toolbar input[type=search] { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
