:root {
  --bg: #f3f4f8; --surface: #fff; --surface2: #eceef4; --text: #1b1d27; --muted: #6b7080; --border: #e0e2ea;
  --accent: #0fa58f; --coral: #ff8a5c; --danger: #d64550; --radius: 12px; --row: 40px; --shadow: 0 8px 30px rgba(20, 22, 40, .14);
  --sans: 'Archivo', system-ui, sans-serif; --mono: 'Geist Mono', ui-monospace, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #13141a; --surface: #1c1e27; --surface2: #262935; --text: #e8e9ef; --muted: #9a9eb0; --border: #2c2f3c; --shadow: 0 8px 30px rgba(0, 0, 0, .5); }
}
:root[data-theme="dark"] { --bg: #13141a; --surface: #1c1e27; --surface2: #262935; --text: #e8e9ef; --muted: #9a9eb0; --border: #2c2f3c; --shadow: 0 8px 30px rgba(0, 0, 0, .5); }
:root[data-density="compact"] { --row: 32px; }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.4 var(--sans); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 6px 12px; }
button:hover { background: var(--surface2); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover { filter: brightness(1.08); }
button.danger { color: var(--danger); }
button.ghost { border-color: transparent; background: transparent; }
button.ghost:hover { background: var(--surface2); }
button:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=password], input[type=date], input[type=time], input[type=search], select, textarea { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; width: 100%; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { resize: vertical; min-height: 90px; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.hidden { display: none !important; }

#app { height: 100%; }
.shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); height: 100%; }
.shell.detail-open { grid-template-columns: 250px minmax(0, 1fr) 380px; }
.side { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 14px 16px; font-weight: 700; font-size: 17px; }
.brand img { width: 28px; height: 28px; }
.nav { overflow: auto; padding: 0 8px 8px; flex: 1; }
.nav h4 { margin: 14px 8px 4px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; color: inherit; text-decoration: none; cursor: pointer; }
.nav a:hover { background: var(--surface2); }
.nav a.on { background: color-mix(in srgb, var(--accent) 16%, transparent); font-weight: 600; }
.nav .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.nav .n { margin-left: auto; font-size: 12px; color: var(--muted); }
.nav .ico { width: 18px; text-align: center; flex: none; }
.me { border-top: 1px solid var(--border); padding: 10px 12px; display: flex; align-items: center; gap: 8px; }
.me .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--coral); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.top { display: flex; align-items: center; gap: 10px; padding: 14px 20px 8px; flex-wrap: wrap; }
.top h1 { font-size: 22px; margin: 0; flex: 1; min-width: 120px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: var(--surface); }
.seg button.on { background: var(--accent); color: #fff; }
.add { display: flex; gap: 8px; padding: 4px 20px 12px; align-items: center; flex-wrap: wrap; }
.add input[type=text] { flex: 1; min-width: 160px; padding: 9px 12px; }
.add input[type=date] { width: auto; }
.scroll { overflow: auto; padding: 0 20px 24px; flex: 1; min-height: 0; }
.group { margin-top: 14px; }
.group > .gh { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 4px 4px; }
.group > .gh.late { color: var(--danger); }
.tasks { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.task { display: flex; align-items: center; gap: 10px; min-height: var(--row); padding: 4px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.task:last-child { border-bottom: 0; }
.task:hover { background: color-mix(in srgb, var(--surface2) 60%, transparent); }
.task.sel { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.task.sub { padding-left: 40px; }
.task.drop { box-shadow: inset 0 2px 0 var(--accent); }
.task.done .title { text-decoration: line-through; color: var(--muted); }
.check { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--muted); background: transparent; padding: 0; flex: none; display: grid; place-items: center; color: #fff; font-size: 13px; line-height: 1; }
.check:hover { border-color: var(--accent); background: transparent; }
.check.p1 { border-color: #6aa3e8; } .check.p2 { border-color: #f0b429; } .check.p3 { border-color: var(--danger); }
.check.done { background: var(--accent); border-color: var(--accent); }
.check.doing { border-color: var(--coral); background: color-mix(in srgb, var(--coral) 35%, transparent); }
.title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chips { display: flex; gap: 6px; align-items: center; flex: none; font-size: 12px; color: var(--muted); }
.chip { padding: 1px 7px; border-radius: 999px; background: var(--surface2); white-space: nowrap; }
.chip.late { color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); }
.chip.today { color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.chip.tag { background: color-mix(in srgb, var(--coral) 18%, transparent); }
.empty { text-align: center; color: var(--muted); padding: 60px 20px; }

.detail { background: var(--surface); border-left: 1px solid var(--border); overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.detail .row { display: grid; grid-template-columns: 96px 1fr; gap: 8px; align-items: center; }
.detail .row > label { color: var(--muted); font-size: 13px; }
.detail .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.detail .ttl { font-size: 18px; font-weight: 600; border: 0; background: transparent; padding: 4px 0; }
.detail h5 { margin: 6px 0 0; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.cm { background: var(--surface2); border-radius: 10px; padding: 8px 10px; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.cm .by { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; }
.act { font-size: 12.5px; color: var(--muted); }
.close { display: none; }

.board { display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr)); gap: 14px; align-items: start; }
.col { background: var(--surface2); border-radius: var(--radius); padding: 10px; min-height: 120px; }
.col.over { outline: 2px dashed var(--accent); }
.col h3 { margin: 0 0 8px 2px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; cursor: grab; }
.card.sel { outline: 2px solid var(--accent); }
.card .chips { margin-top: 6px; flex-wrap: wrap; }

.cal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cal .grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal .dow { padding: 6px; font-size: 12px; color: var(--muted); text-align: center; border-bottom: 1px solid var(--border); }
.cal .day { min-height: 96px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 4px; font-size: 12px; cursor: pointer; overflow: hidden; }
.cal .day:nth-child(7n) { border-right: 0; }
.cal .day.out { background: color-mix(in srgb, var(--surface2) 50%, transparent); color: var(--muted); }
.cal .day.today .num { background: var(--accent); color: #fff; border-radius: 999px; padding: 0 6px; }
.cal .day.pick { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal .ev { display: block; padding: 1px 6px; margin-top: 2px; border-radius: 6px; background: color-mix(in srgb, var(--accent) 18%, transparent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.cal .ev.done { text-decoration: line-through; opacity: .6; }

.modal-bg { position: fixed; inset: 0; background: rgba(10, 12, 20, .5); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); width: min(640px, 100%); max-height: 90vh; overflow: auto; padding: 20px; }
.modal h2 { margin: 0 0 12px; font-size: 19px; }
.modal .tabs { display: flex; gap: 4px; margin-bottom: 14px; flex-wrap: wrap; }
.modal .tabs button { border-color: transparent; background: transparent; }
.modal .tabs button.on { background: var(--surface2); font-weight: 600; }
.field { display: grid; grid-template-columns: 150px 1fr; gap: 8px; align-items: center; margin-bottom: 10px; }
.field > label { color: var(--muted); font-size: 13px; }
.mod { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--border); }
.mod:last-child { border: 0; }
.mod .d { flex: 1; }
.mod .d small { display: block; color: var(--muted); }
.sw { position: relative; width: 40px; height: 22px; flex: none; }
.sw input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.sw i { position: absolute; inset: 0; background: var(--surface2); border: 1px solid var(--border); border-radius: 999px; pointer-events: none; transition: .15s; }
.sw i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: .15s; }
.sw input:checked + i { background: var(--accent); border-color: var(--accent); }
.sw input:checked + i::after { left: 20px; background: #fff; }
.sw input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatches button { width: 26px; height: 26px; border-radius: 50%; padding: 0; border: 2px solid transparent; }
.swatches button.on { border-color: var(--text); }
.urlbox { font-family: var(--mono); font-size: 12px; word-break: break-all; background: var(--surface2); padding: 8px; border-radius: 8px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 10px; z-index: 80; max-width: 90vw; }
.toast.bad { background: var(--danger); color: #fff; }
table.users { width: 100%; border-collapse: collapse; font-size: 14px; }
table.users td, table.users th { padding: 6px 4px; border-bottom: 1px solid var(--border); text-align: left; }

.auth { min-height: 100%; display: grid; place-items: center; padding: 20px; }
.auth form { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; width: min(380px, 100%); display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); }
.auth h1 { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 22px; }
.auth h1 img { width: 34px; }
.err { color: var(--danger); font-size: 14px; min-height: 1em; }
.burger { display: none; }

.embed .brand, .embed .me { display: none; }
@media (max-width: 860px) {
  .shell, .shell.detail-open { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 30; transform: translateX(-100%); transition: transform .18s; box-shadow: var(--shadow); }
  .shell.nav-open .side { transform: none; }
  .burger { display: inline-block; }
  .detail { position: fixed; inset: 0; z-index: 40; }
  .close { display: inline-block; align-self: flex-end; }
  .board { grid-template-columns: minmax(0, 1fr); }
  .field, .detail .row { grid-template-columns: 1fr; }
  .cal .day { min-height: 62px; }
  .chips .opt { display: none; }
}
.gh.head { cursor: pointer; font-size: 15px; font-weight: 700; color: var(--text); text-transform: none; letter-spacing: 0; border-bottom: 2px solid var(--accent); padding-bottom: 4px; }
.gh.head.sel { color: var(--accent); }
.gh.head.drop { outline: 2px dashed var(--accent); }
.nav a .twist { padding: 0 2px; margin-right: 2px; width: 16px; font-size: 11px; line-height: 1; }
.nav a .more { margin-left: auto; padding: 0 6px; font-size: 16px; line-height: 1; opacity: 0; border-radius: 6px; }
.nav a .n + .more { margin-left: 4px; }
.nav a:hover .more, .nav a:focus-within .more, .nav a.on .more { opacity: .75; }
.nav a .more:hover, .nav a .more:focus-visible { opacity: 1; background: var(--surface2); }
@media (hover: none) { .nav a .more { opacity: .6; } }

/* arrastar e largar */
.dragging { opacity: .45; }
.d-before { box-shadow: inset 0 2px 0 var(--accent); }
.d-after { box-shadow: inset 0 -2px 0 var(--accent); }
.d-in { outline: 2px dashed var(--accent); outline-offset: -2px; border-radius: 6px; }
.detail .tsh-row { grid-template-columns: 1fr auto auto; align-items: center; margin-bottom: 6px; }

/* ---- Caixote RSS ---- */
.shell { grid-template-columns: 260px minmax(300px, 420px) minmax(0, 1fr); }
.shell.two { grid-template-columns: 260px minmax(0, 1fr); }
.shell.two .reader { position: fixed; inset: 0 0 0 260px; z-index: 20; display: none; }
.shell.two.reading .reader { display: flex; }
.listpane { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-right: 1px solid var(--border); background: var(--bg); }
.listpane .top h1 { font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search { padding: 0 12px 8px; display: flex; gap: 6px; }
.arts { overflow: auto; flex: 1; min-height: 0; }
.art { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; align-items: flex-start; }
.art:hover { background: color-mix(in srgb, var(--surface2) 60%, transparent); }
.art.sel { background: color-mix(in srgb, var(--accent) 13%, transparent); }
.art .tx { flex: 1; min-width: 0; }
.art .tt { font-weight: 600; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.art.read .tt { font-weight: 400; color: var(--muted); }
.art .meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.art .sn { font-size: 13px; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.art img.th { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; flex: none; background: var(--surface2); }
.art .st { background: transparent; border: 0; padding: 0 2px; font-size: 16px; color: var(--muted); }
.art .st.on { color: #f0b429; }
.art.dropx { outline: 2px dashed var(--accent); outline-offset: -2px; }
.more { padding: 12px; text-align: center; color: var(--muted); }
.reader { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--surface); }
.reader .bar { display: flex; gap: 6px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.reader .bar .sp { flex: 1; }
.reader .body { overflow: auto; padding: 18px clamp(16px, 4vw, 48px) 40px; flex: 1; min-height: 0; }
.reader h1 { font-size: 26px; line-height: 1.2; margin: 0 0 6px; }
.reader h1 a { color: inherit; text-decoration: none; }
.reader .by { color: var(--muted); font-size: 13px; margin-bottom: 14px; display: flex; gap: 10px; flex-wrap: wrap; }
.content { max-width: 74ch; font-size: 16.5px; line-height: 1.65; overflow-wrap: anywhere; }
.content img, .content video, .content iframe { max-width: 100%; height: auto; border-radius: 8px; }
.content pre { overflow: auto; background: var(--surface2); padding: 10px; border-radius: 8px; }
.content blockquote { margin: 1em 0; padding-left: 14px; border-left: 3px solid var(--accent); color: var(--muted); }
.content a { color: var(--accent); }
.tagbox { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 18px; align-items: center; }
.tagbox input { width: 160px; }
.chip.tag { cursor: pointer; }
.nav .feedico { width: 16px; height: 16px; border-radius: 4px; background: var(--surface2); display: grid; place-items: center; font-size: 10px; flex: none; }
.nav a.err .t { color: var(--danger); }
.nav a.drop { outline: 2px dashed var(--accent); outline-offset: -2px; }
.nav a .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.ctx { position: fixed; z-index: 90; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 4px; min-width: 210px; max-height: 80vh; overflow: auto; }
.ctx button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 6px 10px; border-radius: 6px; }
.ctx button:hover, .ctx button:focus-visible { background: var(--surface2); }
.ctx hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.ctx .sub { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 6px 10px 2px; }
.dropzone { position: fixed; inset: 0; z-index: 70; background: color-mix(in srgb, var(--accent) 18%, transparent); border: 4px dashed var(--accent); display: grid; place-items: center; font-size: 22px; font-weight: 700; pointer-events: none; }
.rule { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.rule span { flex: 1; overflow-wrap: anywhere; }
.row2 { display: flex; gap: 8px; align-items: center; }
.row2 > * { min-width: 0; }
.choice { display: block; width: 100%; text-align: left; margin-bottom: 6px; }
.kbd { font-family: var(--mono); font-size: 12px; background: var(--surface2); border-radius: 4px; padding: 0 5px; }
.embed .brand { display: none; }
@media (max-width: 860px) {
  .shell, .shell.two { grid-template-columns: minmax(0, 1fr); }
  .shell .reader, .shell.two .reader { position: fixed; inset: 0; z-index: 40; display: none; }
  .shell.reading .reader { display: flex; }
}
.reader .bar a { color: inherit; text-decoration: none; }
