/* feed - estilos. mobile first, look tipo instagram, minimal */

:root {
  --bg: #FBFAF6;
  --ink: #1A1918;
  --greige: #E6E2D7;
  --muted: #8a857c;
  --white: #fff;
  --danger: #b3453f;
  --radius: 14px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  overflow-x: clip; /* clip no crea caja de scroll, así las pestañas pueden quedarse pegadas */
  width: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Archivo', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
}

.mono, .sheet-chip, .dropdown-meta, .preview-stats {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

button, input, textarea {
  font-family: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

img { max-width: 100%; display: block; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ---------- login ---------- */

.view-login #app,
#app.view-login {
  display: flex;
}

.view-login {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  align-items: center;
  justify-content: center;
  padding: 24px calc(24px + var(--safe-r)) calc(24px + var(--safe-b)) calc(24px + var(--safe-l));
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--white);
  border-radius: var(--radius);
  padding: 32px 24px;
  box-shadow: 0 8px 30px rgba(26,25,24,0.08);
}

.wordmark {
  text-align: center;
  font-size: 22px;
  letter-spacing: 0.28em;
  text-transform: lowercase;
  margin-bottom: 28px;
  color: var(--ink);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--greige);
  background: var(--bg);
  font-size: 15px;
  outline: none;
}

.input:focus {
  border-color: var(--ink);
}

.login-error {
  min-height: 16px;
  font-size: 13px;
  color: var(--danger);
}

.btn {
  padding: 12px 18px;
  border-radius: 10px;
  background: var(--greige);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  display: inline-block;
}

.btn-primary {
  background: var(--ink);
  color: var(--bg);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ---------- header ---------- */

.view-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: var(--safe-t);
  padding-left: var(--safe-l);
  padding-right: var(--safe-r);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.account-switch {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
}

.icon-btn:active {
  background: var(--greige);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.sync-btn.spinning {
  animation: spin 0.8s linear infinite;
}

/* ---------- dropdowns ---------- */

.dropdown {
  z-index: 60;
  min-width: 180px;
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(26,25,24,0.16);
  padding: 6px;
  display: flex;
  flex-direction: column;
}

.dropdown-item {
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
}

.dropdown-item:active {
  background: var(--bg);
}

.dropdown-item.active {
  font-weight: 600;
}

.dropdown-meta {
  padding: 8px 12px 4px;
  font-size: 11px;
  color: var(--muted);
}

/* ---------- tabs ---------- */

.tabs {
  display: flex;
  border-bottom: 1px solid var(--greige);
}

.tab {
  flex: 1;
  padding: 10px 0 12px;
  text-align: center;
  font-size: 18px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}

.tab.active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

/* ---------- content / grid ---------- */

.content {
  flex: 1;
  padding-bottom: calc(96px + var(--safe-b));
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
}

.tile {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--white);
  overflow: hidden;
}

.grid-reels .tile {
  aspect-ratio: 9 / 16;
}

.tile-img-wrap {
  width: 100%;
  height: 100%;
}

.tile-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tile-placeholder {
  width: 100%;
  height: 100%;
  background: var(--greige);
}

.tile.planned {
  box-shadow: inset 0 0 0 1px rgba(26,25,24,0.4);
  outline: none;
}

.tile.planned .tile-img-wrap {
  background-image:
    repeating-linear-gradient(0deg, rgba(26,25,24,0.4) 0 6px, transparent 6px 12px),
    repeating-linear-gradient(90deg, rgba(26,25,24,0.4) 0 6px, transparent 6px 12px),
    repeating-linear-gradient(0deg, rgba(26,25,24,0.4) 0 6px, transparent 6px 12px),
    repeating-linear-gradient(90deg, rgba(26,25,24,0.4) 0 6px, transparent 6px 12px);
  background-size: 1px 100%, 100% 1px, 1px 100%, 100% 1px;
  background-position: 0 0, 0 0, 100% 0, 0 100%;
  background-repeat: no-repeat;
}

.tile-topright {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  z-index: 2;
}

.tile-topleft {
  position: absolute;
  top: 4px;
  left: 4px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  z-index: 2;
}

.badge {
  font-size: 13px;
  color: var(--white);
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

.trash-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(26,25,24,0.55);
  color: var(--white);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* sortablejs states */
.ghost {
  opacity: 0.35;
}

.chosen .tile-img-wrap {
  box-shadow: inset 0 0 0 2px var(--ink);
}

/* ---------- undo/redo pill ---------- */

.undo-pill {
  position: fixed;
  left: 50%;
  bottom: calc(20px + var(--safe-b));
  transform: translateX(-50%);
  display: flex;
  gap: 2px;
  background: var(--white);
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(26,25,24,0.14);
  padding: 4px;
  z-index: 40;
}

.pill-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pill-btn:disabled {
  opacity: 0.3;
}

.pill-btn:not(:disabled):active {
  background: var(--bg);
}

/* ---------- fab ---------- */

.fab {
  position: fixed;
  right: calc(20px + var(--safe-r));
  bottom: calc(84px + var(--safe-b));
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--ink);
  font-size: 26px;
  font-weight: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(26,25,24,0.22);
  z-index: 40;
}

.fab:active {
  transform: scale(0.96);
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(78px + var(--safe-b));
  transform: translate(-50%, 12px);
  background: var(--ink);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 80;
  max-width: 88vw;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- modal (mode dialog / change password) ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,25,24,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
  padding: 24px;
}

.modal-box {
  width: 100%;
  max-width: 320px;
  background: var(--white);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-text {
  margin: 0;
  font-size: 15px;
  text-align: center;
}

.modal-actions {
  display: flex;
  gap: 10px;
}

.modal-actions .btn {
  flex: 1;
}

/* ---------- sheet (detalle) ---------- */

.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,25,24,0);
  z-index: 70;
  display: flex;
  align-items: flex-end;
  transition: background 0.25s ease;
}

.sheet-overlay.open {
  background: rgba(26,25,24,0.35);
}

.sheet {
  width: 100%;
  max-height: 85vh;
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.28s ease;
  padding-bottom: calc(12px + var(--safe-b));
}

.sheet-overlay.open .sheet {
  transform: translateY(0);
}

.sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: var(--greige);
  margin: 10px auto 4px;
  flex-shrink: 0;
}

.sheet-body {
  overflow-y: auto;
  padding: 8px 18px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sheet-preview {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  background: var(--greige);
}

.sheet-track {
  display: flex;
  width: 100%;
  height: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.sheet-slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  scroll-snap-align: start;
}

.sheet-slide img, .sheet-slide video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sheet-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.sheet-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--greige);
}

.sheet-dot.active {
  background: var(--ink);
}

.sheet-chip {
  align-self: flex-start;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--greige);
  font-size: 12px;
}

.sheet-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: -6px;
}

.sheet-collab-note {
  align-self: flex-start;
  font-size: 11px;
  color: var(--muted);
}

.sheet-collab-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sheet-collab-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.sheet-collab-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--ink);
}

.sheet-textarea, .sheet-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--greige);
  background: var(--white);
  font-size: 14px;
  resize: vertical;
}

.sheet-textarea.readonly {
  background: var(--bg);
  color: var(--muted);
}

.sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.sheet-actions .btn {
  flex: 1;
}

.sheet-close {
  align-self: center;
  padding: 10px 0 4px;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- profile preview ---------- */

.preview-view {
  padding-top: var(--safe-t);
  padding-left: var(--safe-l);
  padding-right: var(--safe-r);
  padding-bottom: 40px;
}

.preview-header {
  padding: 14px 16px 0;
}

.preview-exit {
  display: block;
  margin-left: auto;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.preview-top {
  display: flex;
  gap: 16px;
  align-items: center;
  padding-bottom: 18px;
}

.preview-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--greige);
  overflow: hidden;
  flex-shrink: 0;
}

.preview-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.preview-username {
  font-weight: 600;
  font-size: 16px;
}

.preview-stats {
  font-size: 12px;
  color: var(--muted);
}

.preview-bio {
  font-size: 13px;
  color: var(--ink);
  white-space: pre-wrap;
}

/* ---------- misc ---------- */

@media (min-width: 560px) {
  .app-header, .tabs, .content, .sheet-body, .preview-header {
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
  }
}

.dropdown-item .dropdown-tag { margin-left: 10px; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: #8a857c; }

/* arrastrar en el celular: sin el menú nativo de "guardar imagen" ni selección,
   que en ios cancelan el gesto antes de que sortable lo tome */
.grid, .tile, .tile * {
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
.tile { touch-action: manipulation; }
.tile-img-wrap img { -webkit-user-drag: none; user-drag: none; pointer-events: none; }
.tile .trash-btn { pointer-events: auto; }
.sortable-fallback { opacity: .9; transform: scale(1.04); z-index: 9999; }

/* ---------- calendario ---------- */
.content.calendar { display: block; padding: 0 0 120px; overflow-x: clip; }
.cal-sec-title { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding: 14px 14px 8px; }
.cal-unscheduled-row { display: flex; gap: 10px; overflow-x: auto; padding: 0 14px 6px; scrollbar-width: none; }
.cal-unscheduled-row::-webkit-scrollbar { display: none; }
.cal-chip { flex: 0 0 76px; text-align: left; }
.cal-chip .cal-th { width: 76px; height: 76px; border-radius: 6px; overflow: hidden; background: var(--greige); outline: 1px dashed rgba(26,25,24,.35); outline-offset: -3px; }
.cal-chip-title { font-size: 10px; color: var(--muted); margin-top: 4px; line-height: 1.25; max-height: 2.5em; overflow: hidden; }
.cal-th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cal-month { padding: 10px 14px 0; }
.cal-month-title { font-family: 'Archivo', system-ui, sans-serif; font-weight: 600; font-size: 20px; letter-spacing: -.01em; margin: 14px 0 10px; color: var(--ink); }
.cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 0 0 6px 4px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-cell { min-height: 124px; background: #fff; border: 1px solid var(--greige); border-radius: 6px; padding: 6px; display: flex; flex-direction: column; gap: 6px; }
.cal-cell.cal-empty { background: transparent; border-color: transparent; }
.cal-cell.cal-past { opacity: .72; }
.cal-cell.cal-today { border-color: var(--ink); }
.cal-daynum { font-size: 12px; color: var(--muted); }
.cal-today .cal-daynum { color: var(--ink); font-weight: 600; }
.cal-e { display: flex; gap: 8px; align-items: flex-start; text-align: left; width: 100%; padding: 6px; border-radius: 6px; border: 1px solid transparent; }
.cal-e .cal-th { flex: 0 0 44px; width: 44px; height: 44px; border-radius: 4px; overflow: hidden; background: rgba(26,25,24,.08); }
.cal-body { min-width: 0; flex: 1; }
.cal-title { font-size: 12px; line-height: 1.25; color: var(--ink); font-weight: 500; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cal-meta { font-size: 10px; color: var(--muted); margin-top: 3px; letter-spacing: .02em; }
.cal-e-collab { background: #E4ECF1; }
.cal-e-service { background: #EFE9DE; }
.cal-e-pub { background: #F1EFEA; }
.cal-e-pub .cal-title { color: var(--muted); font-weight: 400; }
.cal-e-pub .cal-th { opacity: .7; }
.cal-empty-month { padding: 8px 0 14px; color: var(--muted); font-size: 11px; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 22px 14px 0; font-size: 11px; color: var(--muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 8px; }
.cal-sw { display: inline-block; width: 18px; height: 12px; border-radius: 3px; }

/* calendario en el celular */
@media (max-width: 719px) {
  .cal-month { padding: 6px 12px 0; }
  .cal-month-title { position: sticky; top: 0; background: #FBFAF6; padding: 10px 0 8px; margin: 6px 0 4px; z-index: 2; }
  .cal-legend { flex-direction: column; gap: 8px; padding-top: 18px; }
}

/* ---------- pestañas fijas al bajar ---------- */
.view-app::before { content: ''; position: fixed; top: 0; left: 0; right: 0; height: var(--safe-t); background: var(--bg); z-index: 41; }
@media (max-width: 719px) {
  .cal-month-title { top: calc(var(--tabs-h, 45px) + 42px); margin: 0 0 4px; padding-top: 16px; }
}

/* ---------- post a pantalla completa (antes pop up) ---------- */
.sheet-overlay.page { background: var(--bg); align-items: stretch; transition: none; }
.sheet-overlay.page .sheet {
  max-height: none; height: 100%; border-radius: 0; transform: none; transition: none;
  padding-top: var(--safe-t); padding-bottom: var(--safe-b);
}
.sheet-overlay.page .sheet-handle, .sheet-overlay.page .sheet-close { display: none; }
.page-bar {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
  padding: 10px 14px; border-bottom: 1px solid var(--greige); background: var(--bg);
}
.page-back { font-size: 15px; padding: 6px 4px; }
.page-bar-title { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-overlay.page .sheet-body { flex: 1; padding: 0 0 24px; width: 100%; }
.sheet-overlay.page .sheet-body > * { flex-shrink: 0; }
.sheet-overlay.page .sheet-body > :not(.sheet-preview):not(.sheet-dots) { margin-left: 18px; margin-right: 18px; width: auto; max-width: calc(100% - 36px); }
.sheet-overlay.page .sheet-body > .sheet-textarea, .sheet-overlay.page .sheet-body > .sheet-input, .sheet-overlay.page .sheet-body > .sheet-actions { width: calc(100% - 36px); }
.sheet-overlay.page .sheet-preview { aspect-ratio: auto; border-radius: 0; background: var(--bg); }
.sheet-overlay.page .sheet-track { align-items: center; }
.sheet-overlay.page .sheet-slide { height: auto; }
.sheet-overlay.page .sheet-slide img, .sheet-overlay.page .sheet-slide video {
  width: 100%; height: auto; max-height: 72dvh; object-fit: contain; margin: 0 auto;
}
.sheet-overlay.page .sheet-textarea { min-height: 7.5em; }
@media (min-width: 560px) {
  .sheet-overlay.page .sheet-body, .sheet-overlay.page .page-bar { max-width: 560px; margin-left: auto; margin-right: auto; width: 100%; }
}

/* ---------- modo editar ---------- */
.edit-bar { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--greige); background: var(--bg); min-height: 46px; }
.edit-bar .edit-hint { flex: 1; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.edit-btn { font-size: 13px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--greige); background: #fff; white-space: nowrap; }
.edit-btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.edit-btn:disabled { opacity: .5; }
.edit-icon { width: 34px; height: 34px; border-radius: 50%; font-size: 17px; border: 1px solid var(--greige); background: #fff; }
.edit-icon:disabled { opacity: .35; }
.edit-bar.on { background: #F3EFE6; }
body.editing .undo-pill { display: none; }
body.editing .tile { cursor: grab; }
body.editing .grid .tile.planned { outline: 1px dashed rgba(26,25,24,.35); outline-offset: -3px; }
.review-box { max-height: 82dvh; display: flex; flex-direction: column; }
.review-title { font-weight: 600; }
.review-list { overflow-y: auto; display: flex; flex-direction: column; gap: 2px; margin: 4px 0 10px; }
.review-row { text-align: left; padding: 9px 0; border-bottom: 1px solid var(--greige); font-size: 13px; width: 100%; }
.review-name { font-size: 14px; color: var(--ink); }
.review-dates { font-size: 11px; color: var(--muted); margin-top: 3px; }
.review-note { font-size: 12px; color: var(--muted); margin: 0 0 10px; line-height: 1.4; }
.review-pick:active { background: var(--greige); }

/* ---------- stats ---------- */
.content.stats { display: block; padding: 4px 16px calc(120px + var(--safe-b)); }
.st-sec { padding: 18px 0 16px; border-bottom: 1px solid var(--greige); }
.st-title { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink); margin-bottom: 6px; }
.st-sub { font-size: 12px; color: var(--muted); line-height: 1.4; margin-top: 4px; }
.st-loading { font-size: 11px; color: var(--muted); padding: 8px 0; }
.st-th { flex: 0 0 56px; width: 56px; height: 56px; border-radius: 6px; overflow: hidden; background: var(--greige); }
.st-th img { width: 100%; height: 100%; object-fit: cover; }
.st-next, .st-post { display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left; padding: 10px 0; border-top: 1px solid rgba(230,226,215,.6); }
.st-next.first { border-top: 0; }
.st-next-body, .st-post-body { min-width: 0; flex: 1; }
.st-next-when { font-size: 11px; color: var(--muted); }
.st-next-title, .st-post-title { font-size: 15px; font-weight: 500; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-next-meta { font-size: 11px; color: var(--muted); margin-top: 3px; }
.st-post-nums { font-size: 11px; color: var(--ink); margin-top: 4px; line-height: 1.5; }
.st-kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 10px; }
.st-kpi { background: #fff; border: 1px solid var(--greige); border-radius: 10px; padding: 12px; }
.st-kpi-v { font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.st-kpi-l { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-top: 2px; }
.st-kpi-d { font-size: 11px; margin-top: 6px; color: var(--muted); }
.st-kpi-d.up { color: #5E7A5A; }
.st-kpi-d.down { color: var(--danger); }
.st-flux { font-size: 11px; margin-top: 10px; line-height: 1.5; }
.st-best-days { margin: 8px 0 10px; font-size: 14px; }
.st-best-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.st-best-cell { background: #fff; border: 1px solid var(--greige); border-radius: 8px; padding: 8px 4px; text-align: center; min-width: 0; }
.st-best-cell.best { border-color: var(--ink); background: #F3EFE6; }
.st-best-d { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.st-best-h { font-size: 11px; margin: 5px 0 4px; line-height: 1.35; }
.st-best-n { font-size: 9px; color: var(--muted); }
.st-aud { display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: 8px; }
@media (min-width: 560px) { .st-aud { grid-template-columns: repeat(3, 1fr); } }
.st-aud-h { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.st-bar { display: grid; grid-template-columns: 1fr 70px 34px; gap: 8px; align-items: center; font-size: 12px; padding: 3px 0; }
.st-bar-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-bar-t { height: 6px; background: var(--greige); border-radius: 999px; overflow: hidden; }
.st-bar-f { display: block; height: 100%; background: var(--ink); border-radius: 999px; }
.st-bar-v { font-size: 11px; color: var(--muted); text-align: right; }
.st-dash { display: block; margin: 22px 0 0; }
.sheet-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; font-size: 11px; color: var(--muted); }
.sheet-stat { background: #fff; border: 1px solid var(--greige); border-radius: 8px; padding: 8px 2px; text-align: center; display: flex; flex-direction: column; gap: 2px; }
.sheet-stat b { font-size: 15px; color: var(--ink); font-weight: 600; font-family: 'Archivo', sans-serif; }
.sheet-stat span { font-size: 9px; letter-spacing: .04em; }

/* calendario: mejores momentos */
.cal-cell.cal-bestday { background: #FFFDF8; }

/* ---------- ideas del bot ---------- */
.id-card { background: #fff; border: 1px solid var(--greige); border-radius: 10px; padding: 12px; margin-top: 8px; overflow-wrap: anywhere; }
.id-card.id-hidden { display: none; }
.id-top { font-size: 11px; color: var(--muted); }
.id-title { font-size: 15px; font-weight: 500; margin-top: 3px; line-height: 1.3; }
.id-line { font-size: 13px; margin-top: 6px; line-height: 1.4; }
.id-why { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.4; }
.id-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.id-theme { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 16px 0 2px; }
.id-more { font-size: 11px; color: var(--ink); padding: 8px 0 0; text-decoration: underline; text-underline-offset: 3px; }
.id-warn { font-size: 12px; line-height: 1.45; color: #7A4B12; background: #F7EBD6; border-radius: 8px; padding: 10px 12px; margin-top: 8px; }

/* ---------- estados de post ---------- */
.st-miss { color: #B3453F; }
.st-state { display: inline-flex; align-items: center; gap: 6px; margin-left: 6px; }
.st-state::before { content: '·'; color: var(--muted); margin-right: 2px; }
.st-dot { width: 7px; height: 7px; border-radius: 50%; background: #5E9A5A; box-shadow: 0 0 0 2px #E3EDE0; }
.st-ztag { font-size: 9.5px; letter-spacing: .06em; color: var(--muted); border: 1px solid var(--greige); border-radius: 4px; padding: 1px 5px; background: #fff; }

/* ---------- pestaña ◎ ---------- */
.content.side-home { display: flex; flex-direction: column; gap: 36px; padding: 8px 0 60px; }
.hm-sec { display: flex; flex-direction: column; }
.hm-h { display: flex; align-items: center; gap: 8px; font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.hm-more { margin-left: auto; font-size: 11px; letter-spacing: 0; text-transform: none; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.hm-card { background: #fff; border: 1px solid var(--greige); border-radius: 16px; padding: 20px 22px 18px; }
.hm-row { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; padding: 10px 0; border-top: 1px solid var(--greige); }
.hm-card .hm-row { border-top: 0; }
.hm-row.hm-next { background: var(--bg); border: 1px solid var(--greige); border-radius: 12px; padding: 12px; gap: 16px; margin-bottom: 14px; }
.hm-th { flex: 0 0 44px; width: 44px; height: 44px; border-radius: 4px; overflow: hidden; background: var(--greige); border: 1px solid var(--greige); }
.hm-next .hm-th { flex-basis: 76px; width: 76px; height: 76px; }
.hm-th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hm-body { min-width: 0; flex: 1; }
.hm-when { font-size: 10px; color: var(--muted); }
.hm-title { font-size: 13.5px; font-weight: 500; margin: 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hm-next .hm-title { font-size: 18px; letter-spacing: -.01em; }
.hm-meta { font-size: 10px; color: var(--muted); display: flex; align-items: center; flex-wrap: wrap; }
.hm-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.hm-wk { background: #fff; border: 1px solid var(--greige); border-radius: 9px; padding: 8px 6px; min-height: 84px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.hm-wk.best { background: #F3EFE6; border-color: #d9d1bf; }
.hm-wk-d { font-size: 9.5px; text-transform: uppercase; color: var(--muted); }
.hm-wk-p { font-size: 11.5px; line-height: 1.25; font-weight: 500; flex: 1; white-space: pre-line; overflow-wrap: anywhere; }
.hm-wk-h { font-size: 9.5px; color: var(--muted); }
.hm-wk.best .hm-wk-h { color: #A2741E; }
.hm-foot { font-size: 10px; color: var(--muted); margin-top: 10px; }

/* ---------- calendario del panel ---------- */
.content.calendar { display: block; padding: 0 0 80px; }
.cal-bar { display: flex; align-items: center; gap: 14px; margin: 4px 0 10px; }
.cal-seg { display: inline-flex; gap: 4px; background: #F3EFE6; border-radius: 999px; padding: 4px; flex: 0 0 auto; }
.cal-segb { font-size: 12px; padding: 6px 14px; border-radius: 999px; color: var(--muted); }
.cal-segb.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(26,25,24,.1); }
.cal-legend.top { padding: 0; margin-left: auto; gap: 6px 14px; font-size: 10px; flex-direction: row; min-width: 0; flex-wrap: wrap; }
.cal-legend.top .cal-sw { width: 14px; height: 10px; }
.content.calendar .cal-month { padding: 0 0 10px; }
.content.calendar .cal-grid, .content.calendar .cal-weekdays { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.content.calendar .cal-grid { grid-auto-rows: 136px; }
.content.calendar .cal-cell { height: 136px; min-height: 0; min-width: 0; overflow: hidden; padding: 4px; gap: 4px; display: flex; flex-direction: column; }
.content.calendar .cal-daynum { display: flex; align-items: baseline; justify-content: space-between; gap: 4px; }
.cal-hint { font-size: 7.5px; color: var(--muted); letter-spacing: -.02em; white-space: nowrap; }
.cal-hint.best { color: #A2741E; }
.cal-e.cal-e-v { flex: 1 1 0; min-height: 0; min-width: 0; flex-direction: column; gap: 4px; padding: 4px; overflow: hidden; justify-content: flex-start; }
.cal-e-v .cal-th { width: 100%; height: auto; aspect-ratio: 3 / 2; flex: none; }
.cal-e-v .cal-th img { width: 100%; height: 100%; object-fit: cover; }
.cal-e-v .cal-body { width: 100%; min-width: 0; }
.cal-e-v .cal-title { font-size: 9.5px; line-height: 1.2; -webkit-line-clamp: 2; overflow-wrap: anywhere; }
.cal-e-v .cal-meta { font-size: 8.5px; margin-top: 1px; }
.cal-st { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin-top: 2px; font-size: 7.5px; }
.cal-st .st-state { margin-left: 0; gap: 4px; }
.cal-st .st-state::before { content: none; }
.cal-st .st-dot { width: 6px; height: 6px; }
.cal-st .st-ztag { font-size: 7.5px; padding: 0 3px; }
.cal-st .st-miss { overflow-wrap: anywhere; line-height: 1.2; }
.cal-list { display: flex; flex-direction: column; }
.cal-li { display: grid; grid-template-columns: 150px 44px 1fr; gap: 12px; align-items: center; text-align: left; width: 100%; padding: 10px 0; border-top: 1px solid var(--greige); }
.cal-li-d { font-size: 10.5px; color: var(--muted); }
.cal-li-th { width: 44px; height: 44px; border-radius: 4px; overflow: hidden; background: var(--greige); border: 1px solid var(--greige); }
.cal-li-th img { width: 100%; height: 100%; object-fit: cover; }
.cal-li-t { font-size: 13.5px; font-weight: 500; }
.cal-li-m { font-size: 10px; color: var(--muted); display: flex; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.content.calendar .cal-sec-title { padding-left: 0; padding-right: 0; }
.content.calendar .cal-unscheduled-row { padding-left: 0; padding-right: 0; }
@media (max-width: 719px) {
  .cal-bar { flex-wrap: wrap; }
  .cal-legend.top { margin-left: 0; flex-wrap: wrap; }
  .cal-li { grid-template-columns: 44px 1fr; }
  .cal-li-d { grid-column: 1 / -1; }
}
@media (max-width: 719px) {
  .content.calendar .cal-month-title { top: var(--tabs-h, 45px); margin: 0 0 4px; padding-top: 10px; }
}

/* ---------- shell: escritorio = grid fijo + panel; celular = una zona con 6 pestañas ---------- */
.shell .app-header, .shell .tabs, .shell .content { max-width: none; margin-left: 0; margin-right: 0; }
.shell.wide {
  display: grid;
  grid-template-columns: 560px minmax(0, 1fr);
  column-gap: 144px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px 60px;
  grid-template-areas: "head ." "gtabs stabs" "ebar side" "grid side";
  grid-template-rows: auto auto auto 1fr;
  align-items: start;
}
.shell.wide #header-host { grid-area: head; }
.shell.wide #header-host .app-header { padding: 14px 0 10px; }
.shell.wide #gridtabs-host { grid-area: gtabs; position: sticky; top: var(--safe-t); z-index: 40; background: var(--bg); }
.shell.wide #sidetabs-host { grid-area: stabs; position: sticky; top: var(--safe-t); z-index: 40; background: var(--bg); }
.shell.wide #editbar-host { grid-area: ebar; }
.shell.wide #content-grid { grid-area: grid; }
.shell.wide #content-side { grid-area: side; min-width: 0; padding-top: 22px; }
.shell.wide #alltabs-host { display: none; }
.shell.narrow { max-width: 560px; margin: 0 auto; }
.shell.narrow #gridtabs-host, .shell.narrow #sidetabs-host { display: none; }
.shell.narrow #alltabs-host { position: sticky; top: var(--safe-t); z-index: 40; background: var(--bg); }
.shell.narrow.focus-side #content-grid, .shell.narrow.focus-grid #content-side { display: none; }
.shell.narrow #content-side { padding: 8px 14px 0; }
.icon-btn svg { display: block; }
.order-btn.on { background: var(--greige); }
.sheet-approve { display: flex; align-items: center; gap: 10px; font-size: 14px; padding: 4px 0; }
.sheet-approve input { width: 18px; height: 18px; accent-color: #5E9A5A; }
.shell #editbar-host { position: sticky; top: calc(var(--safe-t) + var(--tabs-h, 45px)); z-index: 39; background: var(--bg); }
.shell.narrow.focus-side ~ .undo-pill { display: none; }
.hm-sug { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--greige); }
.hm-sug-t { font-size: 13px; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hm-sug-d { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
