.spaces-view { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: none; padding: 28px 20px 110px; background: #fff; }
.spaces-view::-webkit-scrollbar, .space-dialog::-webkit-scrollbar { display: none; }
.spaces-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.spaces-heading h2 { margin: 0 0 5px; font-size: 29px; letter-spacing: -.04em; }
.spaces-heading p { margin: 0; color: var(--text-secondary); font-size: 14px; }
.space-create-button { position: fixed; z-index: 12; bottom: calc(var(--bottom-nav-height) + 22px + env(safe-area-inset-bottom)); right: 20px; display: inline-flex; align-items: center; gap: 8px; background: var(--primary); color: white; border-radius: 24px; padding: 15px 20px; font-size: 14px; font-weight: 650; box-shadow: 0 7px 16px #2864e830; }
.space-create-button span { font-size: 23px; line-height: 1; }
.spaces-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.space-card { --space-color: #2864e8; position: relative; min-width: 0; display: flex; align-items: stretch; background: #fff; border: 1px solid #e8ebf2; border-radius: 21px; transition: box-shadow .18s, border-color .18s; }
.space-card:hover { border-color: var(--space-color); box-shadow: 0 8px 24px #162f5c09; }
.space-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 15px; padding: 20px 12px 20px 18px; text-align: left; color: var(--text-primary); background: transparent; border-radius: inherit; }
.space-icon { display: grid; place-items: center; flex-shrink: 0; width: 54px; height: 58px; border-radius: 17px; font-size: 28px; color: var(--space-color); background: color-mix(in srgb, var(--space-color) 10%, white); }
.space-card-copy { min-width: 0; flex: 1; }
.space-card-copy strong { display: block; font-size: 17px; font-weight: 700; overflow-wrap: anywhere; line-height: 1.25; }
.space-card-description { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 5px 0 0; font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; }
.space-card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 9px; }
.space-card-meta { font-size: 12px; color: #87909e; }
.space-card-menu { align-self: center; flex-shrink: 0; width: 34px; min-height: 44px; margin-right: 5px; font-size: 22px; color: #89919d; background: transparent; border-radius: 12px; }
.space-card-menu:hover { background: #f4f6fa; }
.space-avatars { display: inline-flex; flex-shrink: 0; padding-left: 5px; }
.space-avatar { display: inline-grid; place-items: center; width: 28px; height: 28px; margin-left: -6px; border: 2px solid #fff; border-radius: 50%; background: #eef2fc; color: #486096; font-size: 10px; font-weight: 700; object-fit: cover; }
.spaces-empty { text-align: center; padding: 45px 12px; }
.spaces-empty-icon { display: inline-grid; place-items: center; width: 76px; height: 76px; background: #f2f6ff; font-size: 35px; border-radius: 24px; }
.spaces-empty h3 { font-size: 20px; margin: 18px 0 8px; }
.spaces-empty p { font-size: 13px; line-height: 1.7; color: var(--text-secondary); margin-bottom: 24px; }
.spaces-status { color: var(--text-secondary); font-size: 13px; }
.spaces-status button { margin-left: 8px; color: var(--primary); background: transparent; text-decoration: underline; }
.space-dialog { max-height: calc(100dvh - 32px); overflow-y: auto; scrollbar-width: none; width: min(460px, calc(100% - 28px)); }
.space-dialog h2 { font-size: 22px; margin: 5px 0 18px; letter-spacing: -.03em; }
.space-field { display: block; font-size: 12px; font-weight: 650; margin: 16px 0; }
.space-field input { display: block; width: 100%; margin-top: 7px; border: 1px solid #e3e8f1; background: #f9fafc; border-radius: 11px; padding: 12px; color: var(--text-primary); min-height: 44px; }
.space-field input[type="color"] { padding: 5px; cursor: pointer; height: 47px; }
.space-optional { color: var(--text-secondary); font-weight: 400; }
.space-customization { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.space-customization .space-field { margin-top: 0; }
.space-emoji-options { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; }
.space-emoji-options button { min-height: 40px; background: #f4f6fa; border-radius: 10px; font-size: 23px; }
.space-emoji-options button:hover { background: #eaf0ff; }
.space-preview { display: flex; align-items: center; gap: 14px; background: #f8faff; padding: 16px; border-radius: 16px; }
.space-preview > span { display: grid; place-items: center; width: 52px; min-width: 52px; height: 52px; font-size: 29px; border-radius: 15px; background: #2864e81a; }
.space-preview strong { display: block; overflow-wrap: anywhere; }
.space-preview small { display: block; font-size: 11px; color: var(--text-secondary); margin-top: 4px; }
.space-dialog-copy { font-size: 12.5px; line-height: 1.65; color: var(--text-secondary); overflow-wrap: anywhere; }
.space-form-error { color: var(--danger); font-size: 13px; line-height: 1.5; }
.space-member-list { display: grid; gap: 10px; margin: 16px 0; max-height: 190px; overflow-y: auto; scrollbar-width: none; }
.space-member { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.space-member .space-avatar { margin: 0; width: 34px; height: 34px; }
.space-member small { color: var(--text-secondary); margin-left: auto; font-size: 11px; }
.space-qr { text-align: center; padding: 20px 0 2px; }
.space-qr svg { display: block; width: min(232px, 100%); height: auto; margin: auto; background: white; }
.space-invite-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.space-dialog button:disabled { opacity: .55; cursor: wait; }
.space-dialog .primary-button, .space-dialog .secondary-button, .spaces-empty .primary-button {
    min-height: 44px; padding: 10px 15px; border-radius: 11px; font-size: 13px; font-weight: 650;
}
.space-dialog .primary-button, .spaces-empty .primary-button { background: var(--primary); color: white; }
.space-dialog .secondary-button { background: #f4f6fa; color: #52647b; }
.space-back { color: var(--primary); background: transparent; padding: 0 8px 0 0; font-size: 29px; min-width: 32px; min-height: 40px; }
.in-space .brand-lockup { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 6px; min-width: 0; }
.in-space .brand-lockup .space-back { grid-row: 1 / 3; }
.in-space #app-header-title { align-self: end; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 20px; }
.in-space #app-header-subtitle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.in-space .app-header { gap: 8px; border-bottom: 2px solid var(--space-color); }
.in-space .header-actions { flex-shrink: 0; gap: 4px; }
.space-members-desktop { background: #f4f6fa; border-radius: 12px; padding: 10px 12px; color: #52647b; min-height: 44px; font-size: 12px; margin-right: 8px; }
.item-sender { margin: 0 28px 8px 0; color: var(--space-color, var(--primary)); font-size: 11px; font-weight: 700; }
@media (min-width: 900px) {
    .spaces-view { border-radius: 20px; background: #f4f6f8; padding: 22px; border: 1px solid #e8ebef; }
    .spaces-heading { display: none; }
    .spaces-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
    .space-card { border-top: 4px solid var(--space-color); border-radius: 18px; }
    .space-open { flex-direction: column; align-items: flex-start; gap: 18px; min-height: 195px; padding: 22px; }
    .space-card-copy { width: 100%; }
    .space-card-copy strong { font-size: 19px; padding-right: 15px; }
    .space-card-description { min-height: 36px; }
    .space-card-menu { position: absolute; top: 14px; right: 6px; }
    .space-icon { width: 58px; height: 58px; }
    .desktop-space-back { align-self: flex-start; min-height: 22px; font-size: 11px; margin-bottom: 4px; }
    .in-space .desktop-header-card { border-left: 3px solid var(--space-color); }
    .in-space .desktop-view-title { font-size: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .in-space .desktop-header-search { min-width: 180px; max-width: 230px; }
    .in-space .desktop-quick-card { flex-wrap: wrap; gap: 4px; padding: 8px 10px; }
    .in-space .quick-mini-btn { padding: 4px; }
}
@media (min-width: 600px) and (max-width: 899px) { .spaces-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Listas siempre a mano dentro del espacio: una fila móvil y una columna desktop. */
.space-lists-panel { flex-shrink: 0; min-width: 0; padding: 10px 16px 12px; background: #fff; border-bottom: 1px solid var(--border); }
.space-lists-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.space-lists-panel-heading h2 { margin: 0; font-size: 12px; font-weight: 750; color: #52647b; }
.space-lists-panel-summary { display: none; }
.space-list-create { display: inline-flex; align-items: center; gap: 3px; min-height: 36px; background: transparent; color: var(--primary); padding: 4px 6px; font-size: 12px; font-weight: 650; }
.space-list-create > span { font-size: 20px; }
.space-lists-panel-content { display: flex; flex-wrap: nowrap; gap: 10px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: none; padding: 3px; margin: -3px; }
.space-lists-panel-content::-webkit-scrollbar { display: none; }
.space-list-panel-card { flex: 0 0 185px; min-width: 0; scroll-snap-align: start; border: 1px solid #e4e9f1; border-radius: 14px; background: #f9fbff; }
.space-list-card-heading { margin: 0; font-size: inherit; }
.space-list-open { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 70px; padding: 11px; border-radius: 14px; background: transparent; color: var(--text-primary); text-align: left; }
.space-list-open:hover { background: var(--primary-soft); }
.space-list-card-icon { display: grid; place-items: center; flex-shrink: 0; width: 27px; height: 30px; border-radius: 9px; color: var(--space-color, var(--primary)); background: color-mix(in srgb, var(--space-color, var(--primary)) 9%, white); font-size: 18px; }
.space-list-card-copy { flex: 1; min-width: 0; }
.space-list-card-copy strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; font-size: 12px; line-height: 1.4; font-weight: 700; }
.space-list-card-copy > span { display: block; margin-top: 5px; color: #64748b; font-size: 10px; line-height: 1.4; font-weight: 500; }
.space-list-card-arrow { display: none; }
.space-list-full { display: none; }
.space-lists-panel-empty { margin: 0; padding: 5px 0; color: #64748b; font-size: 12px; line-height: 1.6; }
.space-lists-panel-status { margin: 8px 0 0; padding: 8px; border-radius: 9px; background: #fff5df; color: #81581a; font-size: 11px; line-height: 1.5; }
@media (min-width: 900px) {
    .app-shell.in-space { display: grid; grid-template-columns: minmax(0, 1fr) clamp(280px, 25vw, 340px); grid-template-rows: auto minmax(0, 1fr) auto; gap: 12px; }
    .app-shell.in-space > .app-top-bar { grid-column: 1 / -1; grid-row: 1; }
    .app-shell.in-space > .feed { grid-column: 1; grid-row: 2; min-width: 0; }
    .app-shell.in-space > .composer-wrap { grid-column: 1; grid-row: 3; min-width: 0; }
    .app-shell.in-space > .offline-banner { grid-column: 1; grid-row: 2; align-self: end; z-index: 11; }
    .space-lists-panel { grid-column: 2; grid-row: 2 / 4; display: flex; flex-direction: column; min-height: 0; overflow: hidden; padding: 16px; border: 1px solid #e4e9f1; border-radius: 20px; box-shadow: 0 3px 12px #162f5c04; }
    .space-lists-panel-heading { flex-shrink: 0; margin-bottom: 16px; }
    .space-lists-panel-heading h2 { font-size: 14px; color: var(--text-primary); }
    .space-lists-panel-summary { display: block; margin-top: 4px; font-size: 11px; color: #64748b; }
    .space-list-create { min-height: 44px; }
    .space-lists-panel-content { display: block; flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior-y: contain; scroll-snap-type: none; }
    .space-list-panel-card { margin-bottom: 12px; background: #fff; }
    .space-list-panel-card:last-child { margin-bottom: 0; }
    .space-list-open { gap: 8px; padding: 13px 12px; border-radius: 14px 14px 0 0; background: #f7f9fd; }
    .space-list-card-copy strong { display: block; font-size: 13px; }
    .space-list-card-copy > span { font-size: 11px; }
    .space-list-card-arrow { display: block; color: #718299; font-size: 18px; }
    .space-list-full { display: block; padding: 0 12px 12px; }
    .space-list-checklist { margin: 0; padding: 0; list-style: none; }
    .space-list-row { border-bottom: 1px solid #eff1f5; }
    .space-list-row label { display: flex; gap: 9px; align-items: flex-start; min-height: 44px; padding: 12px 0; cursor: pointer; }
    .space-list-row input { flex-shrink: 0; width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--primary); }
    .space-list-row label > span { min-width: 0; font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
    .space-list-row.is-done .space-list-entry-text { color: #7c838e; text-decoration: line-through; }
    .space-list-row small { display: block; color: #64748b; font-size: 10px; line-height: 1.6; margin-top: 3px; }
    .space-list-no-entries { color: #64748b; font-size: 12px; line-height: 1.6; }
    .space-list-add { position: relative; display: flex; gap: 6px; margin-top: 12px; }
    .space-list-add input { width: 100%; min-width: 0; min-height: 44px; padding: 8px 10px; border: 1px solid #e1e7f0; border-radius: 10px; background: #f9fafc; color: var(--text-primary); font-size: 12px !important; }
    .space-list-add button { flex-shrink: 0; width: 36px; min-height: 44px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); font-size: 21px; }
    .space-list-add button:disabled, .space-list-row input:disabled { opacity: .55; cursor: wait; }
    .space-lists-panel-empty { margin-top: 6px; }
    .space-lists-panel-content:empty { flex: 0; }
}
@media (min-width: 900px) and (max-width: 1199px) {
    .in-space .desktop-header-row { flex-direction: column; gap: 10px; }
    .in-space .desktop-quick-card { justify-content: flex-start; }
    .in-space .feed { padding: 12px; }
    .in-space .composer-row { gap: 4px; padding: 6px; }
    .in-space .composer-icon-btn { width: 34px; height: 38px; }
}
