/* Workspace — mae.pedrolascasas.com */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1c2430;
  --ink-soft: #667085;
  --accent: #2f54d6;
  --accent-dark: #2343b4;
  --danger: #b42318;
  --line: #e4e7ec;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --shadow-big: 0 8px 28px rgba(16,24,40,.18);
  --radius: 12px;
}
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--ink);
  font-size: 16px; line-height: 1.45;
  min-height: 100dvh;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
::placeholder { color: #98a2b3; }
svg.ic { width: 22px; height: 22px; stroke: currentColor; fill: none;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- header ---------- */
header.top {
  position: sticky; top: 0; z-index: 30;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: max(10px, env(safe-area-inset-top)) 16px 10px;
  display: flex; align-items: center; gap: 12px;
}
.brand { font-weight: 700; font-size: 17px; letter-spacing: -.2px; display: flex; align-items: center; gap: 9px; }
.brand .mark { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); flex: none;
  display: flex; align-items: center; justify-content: center; }
.brand .mark svg { width: 15px; height: 15px; stroke: #fff; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabs {
  margin-left: auto; display: flex; background: #eef0f3; border-radius: 9px; padding: 3px;
}
.tabs button {
  padding: 7px 16px; border-radius: 7px; font-weight: 600; font-size: 14.5px; color: var(--ink-soft);
  transition: all .15s;
}
.tabs button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.iconbtn {
  width: 40px; height: 40px; border-radius: 9px; flex: none; color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
}
.iconbtn:active { background: #eef0f3; }
@media (hover:hover) { .iconbtn:hover { background: #eef0f3; color: var(--ink); } }

/* ---------- layout ---------- */
main { max-width: 900px; margin: 0 auto; padding: 16px 16px calc(110px + env(safe-area-inset-bottom)); }

/* ---------- files ---------- */
.filebar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; font-weight: 600; font-size: 14.5px; min-width: 0; }
.crumbs button { color: var(--accent); padding: 6px 6px; border-radius: 7px; max-width: 40vw;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 5px; }
.crumbs button svg.ic { width: 17px; height: 17px; }
.crumbs button:last-child { color: var(--ink); pointer-events: none; }
.crumbs .sep { color: #b9c0cc; }
.search {
  margin-left: auto; flex: 1 1 160px; max-width: 260px;
  background: var(--card); border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 13px; outline: none; font-size: 15px;
}
.search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,84,214,.12); }

.filelist { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 12px 8px 12px 14px; border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.row:active { background: #f4f6fa; }
@media (hover:hover) { .row:hover { background: #f7f8fa; } }
.row .ficon { flex: none; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; }
.row .fmeta { min-width: 0; flex: 1; }
.row .fname { font-weight: 600; font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .fsub { font-size: 13px; color: var(--ink-soft); margin-top: 1px; }
.row .more {
  flex: none; width: 44px; height: 44px; border-radius: 9px; color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
}
.row .more:active { background: #eef0f3; }
@media (hover:hover) { .row .more:hover { background: #eef0f3; color: var(--ink); } }
.emptybox { text-align: center; padding: 56px 20px; color: var(--ink-soft); font-size: 15px; }
.emptybox svg.ic { width: 44px; height: 44px; stroke-width: 1.3; margin-bottom: 12px; color: #b9c0cc; }

/* drag & drop */
.droptarget { outline: 2px dashed var(--accent); outline-offset: -2px; }

/* ---------- FAB ---------- */
.fab {
  position: fixed; right: 20px; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 40;
  width: 58px; height: 58px; border-radius: 16px;
  background: var(--accent); color: #fff;
  box-shadow: var(--shadow-big); display: flex; align-items: center; justify-content: center;
  transition: transform .12s;
}
.fab svg.ic { width: 26px; height: 26px; stroke-width: 2; }
.fab:active { transform: scale(.94); background: var(--accent-dark); }

/* ---------- notes ---------- */
.board-head { display: flex; align-items: center; margin-bottom: 14px; }
.board-head h2 { font-size: 18px; font-weight: 700; }
.btn {
  background: var(--accent); color: #fff; font-weight: 600; font-size: 15px;
  padding: 10px 18px; border-radius: 9px;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn svg.ic { width: 18px; height: 18px; stroke-width: 2; }
.btn:active { background: var(--accent-dark); }
.btn.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: var(--danger); }
.board { column-count: 2; column-gap: 14px; }
@media (min-width: 700px) { .board { column-count: 3; } }
@media (max-width: 460px) { .board { column-count: 1; } }
.note {
  break-inside: avoid; margin-bottom: 14px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line);
  border-top: 4px solid #f0c419;
  padding: 12px 14px 8px; box-shadow: var(--shadow); position: relative;
}
.note.c-amarelo { border-top-color: #eab308; }
.note.c-rosa { border-top-color: #d6604f; }
.note.c-azul { border-top-color: #4779e8; }
.note.c-verde { border-top-color: #3f9e63; }
.note input.ntitle {
  width: 100%; border: 0; background: transparent; outline: none;
  font-weight: 700; font-size: 15.5px; margin-bottom: 4px;
}
.note textarea {
  width: 100%; border: 0; background: transparent; outline: none; resize: none;
  min-height: 42px; line-height: 1.45; font-size: 15px;
}
.note .nfoot { display: flex; align-items: center; gap: 7px; margin-top: 8px; }
.note .nwho { font-size: 12.5px; color: var(--ink-soft); margin-right: auto; }
.cdot { width: 19px; height: 19px; border-radius: 50%; border: 2px solid transparent; }
.cdot.on { border-color: var(--ink); }
.d-amarelo { background: #eab308; } .d-rosa { background: #d6604f; }
.d-azul { background: #4779e8; } .d-verde { background: #3f9e63; }
.ndel { color: var(--ink-soft); padding: 4px 6px; border-radius: 7px; }
.ndel svg.ic { width: 17px; height: 17px; }
.ndel:active { background: #eef0f3; }
@media (hover:hover) { .ndel:hover { color: var(--danger); background: #eef0f3; } }

/* ---------- sheets & modals ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 60; background: rgba(16,24,40,.5);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .15s;
}
@media (min-width: 640px) { .scrim { align-items: center; } }
@keyframes fade { from { opacity: 0; } }
.sheet {
  background: var(--card); width: 100%; max-width: 460px;
  border-radius: 16px 16px 0 0; padding: 8px 12px calc(16px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-big); animation: rise .18s ease-out;
}
@media (min-width: 640px) { .sheet { border-radius: 16px; padding-bottom: 14px; } }
@keyframes rise { from { transform: translateY(30px); opacity: .6; } }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 6px auto 10px; }
.sheet h3 { font-size: 13.5px; margin: 4px 10px 8px; color: var(--ink-soft); font-weight: 600;
  text-transform: uppercase; letter-spacing: .4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet .item {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 13px 12px; border-radius: 9px; font-weight: 550; font-size: 15.5px;
}
.sheet .item:active { background: #f4f6fa; }
@media (hover:hover) { .sheet .item:hover { background: #f7f8fa; } }
.sheet .item svg.ic { color: var(--ink-soft); }
.sheet .item.danger, .sheet .item.danger svg.ic { color: var(--danger); }
.modal { background: var(--card); border-radius: 14px; width: calc(100% - 40px); max-width: 420px;
  padding: 22px 20px; box-shadow: var(--shadow-big); animation: rise .18s ease-out; }
.scrim.center { align-items: center; }
.modal h3 { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.modal p { color: var(--ink-soft); margin-bottom: 14px; font-size: 14.5px; word-break: break-word; }
.modal input {
  width: 100%; padding: 11px 13px; border: 1.5px solid var(--line); border-radius: 9px;
  outline: none; margin-bottom: 12px; background: #fbfcfd; font-size: 15.5px;
}
.modal input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,84,214,.12); }
.modal .acts { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }
.modal .acts .btn { padding: 10px 16px; }
.err { color: var(--danger); font-size: 14px; margin: -4px 0 8px; min-height: 0; }

/* ---------- toast & progress ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(100px + env(safe-area-inset-bottom)); z-index: 80;
  background: #1c2430; color: #fff; padding: 11px 18px; border-radius: 9px;
  font-weight: 550; font-size: 14.5px; box-shadow: var(--shadow-big);
  max-width: calc(100% - 40px); text-align: center;
  animation: fade .2s;
}
.upbox {
  position: fixed; left: 16px; right: 16px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 50;
  max-width: 420px; margin: 0 auto;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow-big); padding: 13px 15px;
}
.upbox .ulabel { font-weight: 600; font-size: 14px; margin-bottom: 8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upbox .track { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.upbox .fill { height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width .2s; }

/* ---------- login ---------- */
.loginwrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.logincard { background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); padding: 36px 30px; width: 100%; max-width: 380px; text-align: center; }
.logincard .mark { width: 52px; height: 52px; border-radius: 14px; background: var(--accent);
  margin: 0 auto 16px; display: flex; align-items: center; justify-content: center; }
.logincard .mark svg { width: 26px; height: 26px; stroke: #fff; fill: none; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; }
.logincard h1 { font-size: 21px; font-weight: 700; margin-bottom: 4px; letter-spacing: -.3px; }
.logincard .sub { color: var(--ink-soft); font-size: 14.5px; margin-bottom: 24px; }
.logincard input {
  width: 100%; padding: 13px 15px; font-size: 16px;
  border: 1.5px solid var(--line); border-radius: 10px; outline: none; background: #fbfcfd;
  margin-bottom: 14px;
}
.logincard input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,84,214,.12); }
.logincard .btn { width: 100%; padding: 13px; font-size: 16px; border-radius: 10px; justify-content: center; }

/* ---------- editor page ---------- */
.edittop {
  height: 50px; display: flex; align-items: center; gap: 4px; padding: 0 8px;
  background: var(--card); border-bottom: 1px solid var(--line);
}
.edittop .back { font-size: 15px; font-weight: 600; color: var(--accent);
  padding: 9px 12px 9px 6px; border-radius: 8px; flex: none;
  display: flex; align-items: center; gap: 2px; }
.edittop .back svg.ic { width: 19px; height: 19px; stroke-width: 2.2; }
.edittop .fname { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#ooframe { position: fixed; inset: 50px 0 0 0; }
.editmsg { padding: 60px 24px; text-align: center; color: var(--ink-soft); }

/* image lightbox */
.lightbox { position: fixed; inset: 0; z-index: 70; background: rgba(12,16,24,.93);
  display: flex; align-items: center; justify-content: center; padding: 18px; }
.lightbox img { max-width: 100%; max-height: 92dvh; border-radius: 8px; }
.lightbox .close { position: fixed; top: max(14px, env(safe-area-inset-top)); right: 16px;
  color: #fff; padding: 10px; }
.lightbox .close svg.ic { width: 26px; height: 26px; }

/* ---------- assistant chat ---------- */
#chatpanel {
  position: fixed; inset: 0; z-index: 55;
  background: var(--card); display: flex; flex-direction: column;
}
#chatpanel[hidden] { display: none; }
@media (min-width: 700px) {
  #chatpanel {
    inset: auto 16px 16px auto; top: 74px; width: 410px;
    border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-big);
  }
}
.chead {
  display: flex; align-items: center; gap: 4px;
  padding: max(8px, env(safe-area-inset-top)) 10px 8px 16px; border-bottom: 1px solid var(--line);
}
@media (min-width: 700px) { .chead { padding-top: 8px; } }
.ctitle { font-weight: 700; font-size: 15.5px; margin-right: auto; }
.cctx {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  padding: 9px 14px; border-bottom: 1px solid var(--line); background: #f7f8fa;
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; color: var(--ink);
  background: #eef0f3; border: 1px solid var(--line); padding: 4px 10px; border-radius: 999px;
  max-width: 100%;
}
.chip svg.ic { width: 14px; height: 14px; color: var(--ink-soft); }
.chip .clabel { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.chip button { display: flex; padding: 1px; color: var(--ink-soft); }
.chip button svg.ic { width: 13px; height: 13px; }
.chip.accent { background: #e8edfb; border-color: #c6d2f4; color: var(--accent-dark); }
.chip.accent svg.ic { color: var(--accent); }
.cmsgs {
  flex: 1; overflow-y: auto; padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.cempty { margin: auto; text-align: center; color: var(--ink-soft); font-size: 13.5px;
  max-width: 260px; line-height: 1.5; }
.cempty svg.ic { width: 34px; height: 34px; stroke-width: 1.4; color: #b9c0cc; margin-bottom: 10px; }
.msg { max-width: 88%; padding: 9px 13px; border-radius: 12px; font-size: 14.5px; line-height: 1.5;
  overflow-wrap: break-word; }
.msg.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.msg.ai { align-self: flex-start; background: #f1f3f6; border-bottom-left-radius: 4px; }
.msg.ai ul, .msg.ai ol { padding-left: 20px; margin: 4px 0; }
.msg.ai p { margin: 0 0 6px; } .msg.ai p:last-child { margin-bottom: 0; }
.msg.ai code { background: #e4e7ec; border-radius: 4px; padding: 0 4px; font-size: 13px; }
.msg.err { align-self: flex-start; background: #fdecea; color: var(--danger); }
.cstatus { align-self: flex-start; color: var(--ink-soft); font-size: 12.5px; font-style: italic;
  padding: 0 4px; }
.cstep {
  align-self: stretch; display: flex; align-items: center; gap: 8px;
  color: var(--ink-soft); font-size: 13px; padding: 3px 4px;
}
.cstep-ic { width: 18px; height: 18px; flex: none; border-radius: 50%; background: #e4ece6;
  display: flex; align-items: center; justify-content: center; }
.cstep-ic svg.ic { width: 12px; height: 12px; stroke-width: 2.6; color: #3f9e63; }
.cstep.active .cstep-ic { background: #e8edfb; }
.cstep.active .cstep-ic svg.ic { color: var(--accent); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
.typing { align-self: flex-start; display: flex; gap: 4px; padding: 12px 14px;
  background: #f1f3f6; border-radius: 12px; border-bottom-left-radius: 4px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: #98a2b3;
  animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
.ccomposer {
  display: flex; gap: 8px; align-items: flex-end;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line);
}
@media (min-width: 700px) { .ccomposer { padding-bottom: 10px; } }
.ccomposer textarea {
  flex: 1; resize: none; border: 1.5px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font-size: 15px; outline: none; background: #fbfcfd;
  max-height: 120px; line-height: 1.4;
}
.ccomposer textarea:focus { border-color: var(--accent); }
.csend {
  width: 42px; height: 42px; border-radius: 10px; flex: none;
  background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center;
}
.csend:disabled { background: #b9c0cc; }
.csend svg.ic { width: 20px; height: 20px; stroke-width: 2.2; }

/* ---------- context picker (devtools-style) ---------- */
.chip.pickbtn { cursor: pointer; background: var(--card); border-style: dashed; color: var(--accent-dark); }
.chip.pickbtn svg.ic { color: var(--accent); }
.chip.pickbtn:active, .chip.pickbtn:hover { background: #e8edfb; }
#chatpanel.pickhide { display: none; }
body.picking .row { cursor: crosshair; }
body.picking .row:hover, body.picking .row:active { outline: 2px solid var(--accent); outline-offset: -2px; background: #e8edfb; }
body.picking .fab { display: none !important; }
.pickbanner {
  position: fixed; top: calc(env(safe-area-inset-top) + 66px); left: 50%; transform: translateX(-50%);
  z-index: 65; background: #1c2430; color: #fff;
  padding: 10px 12px 10px 16px; border-radius: 12px; box-shadow: var(--shadow-big);
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center;
  font-size: 14px; font-weight: 550; width: max-content; max-width: calc(100% - 24px);
}
.pickbanner button {
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25);
  color: #fff; font-weight: 600; font-size: 13.5px; padding: 7px 12px; border-radius: 8px;
}
.pickbanner button:active, .pickbanner button:hover { background: rgba(255,255,255,.26); }

/* ---------- chat history list ---------- */
.clist-row {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 8px 11px 14px; border: 1px solid var(--line); border-radius: 10px;
  margin-bottom: 8px; cursor: pointer;
}
.clist-row:hover { background: #f7f8fa; }
.clist-meta { min-width: 0; flex: 1; }
.clist-title { display: block; font-weight: 600; font-size: 14.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clist-date { font-size: 12.5px; color: var(--ink-soft); }
.clist-del { color: var(--ink-soft); padding: 8px; border-radius: 8px; flex: none; }
.clist-del svg.ic { width: 17px; height: 17px; }
.clist-del:hover { color: var(--danger); background: #eef0f3; }

@media (max-width: 480px) {
  .brand .btxt { display: none; }
  .tabs { margin-left: 4px; }
  .search { max-width: none; }
}
