:root {
    --brand: #9D162E;
    --brand-dark: #7a1024;
    --bg: #f8fafc;
    --border: #e2e8f0;
}

body, html {
    margin: 0;
    padding: 0;
    min-height: 100%;
    font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
    background: var(--bg);
    color: #1e293b;
}

.tb-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1.5rem;
    background: var(--brand);
    color: white;
}

.tb-header-title {
    font-size: 1.1rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.tb-tabs {
    display: flex;
    gap: 0.4rem;
    padding: 0.75rem 1.5rem 0;
    background: white;
    border-bottom: 1px solid var(--border);
}

.tb-tabs[hidden] {
    display: none;
}

.tb-tab {
    background: var(--bg);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 0.4rem 0.4rem 0 0;
    padding: 0.5rem 1.1rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
}

.tb-tab-activa {
    background: white;
    color: var(--brand);
    position: relative;
    top: 1px;
}

.tb-main {
    max-width: 72rem;
    margin: 0 auto;
    padding: 1.75rem 1.5rem 3rem;
    min-height: calc(100vh - 4rem - 6.5rem - 5rem);
}

.tb-bloqueado {
    max-width: 28rem;
    margin: 4rem auto 0;
    text-align: center;
}

.tb-bloqueado h2 {
    color: var(--brand);
    font-size: 1.3rem;
    margin: 0 0 0.75rem;
}

.tb-bloqueado p {
    color: #475569;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0.3rem 0;
}

.tb-seccion-cabecera {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.tb-seccion-cabecera h2 {
    color: var(--brand);
    font-size: 1.2rem;
    margin: 0;
}

.tb-btn {
    background: var(--brand);
    color: white;
    border: none;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0.5rem 1.1rem;
    border-radius: 0.4rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.tb-btn:hover {
    background: var(--brand-dark);
}

.tb-btn-secundario {
    background: white;
    color: #475569;
    border: 1px solid var(--border);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.45rem 0.9rem;
    border-radius: 0.4rem;
    cursor: pointer;
}

.tb-btn-secundario:hover {
    background: var(--bg);
}

.tb-icon-btn {
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.2rem 0.4rem;
}

.tb-icon-btn:hover {
    color: var(--brand);
}

.tb-icon-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Tabla de materiales */
.tb-tabla {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    overflow: hidden;
    font-size: 0.85rem;
}

.tb-tabla th {
    text-align: left;
    background: var(--bg);
    color: #64748b;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.55rem 0.8rem;
    border-bottom: 1px solid var(--border);
}

.tb-tabla td {
    padding: 0.5rem 0.8rem;
    border-bottom: 1px solid var(--border);
}

.tb-tabla tr:last-child td {
    border-bottom: none;
}

.tb-col-acciones {
    white-space: nowrap;
    text-align: right;
}

.tb-swatch {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border-radius: 0.25rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.tb-vacio {
    color: #94a3b8;
    font-size: 0.85rem;
    text-align: center;
    padding: 1.5rem 0;
}

/* Grid de muros */
.tb-grid-muros {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.1rem;
}

.tb-card-muro {
    background: white;
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.tb-muro-imagen {
    width: 100%;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    line-height: 0;
}

.tb-muro-body {
    padding: 0.9rem 1.1rem 1.1rem;
}

.tb-muro-body h3 {
    margin: 0 0 0.35rem;
    color: var(--brand);
    font-size: 1rem;
}

.tb-muro-datos {
    margin: 0 0 0.8rem;
    color: #64748b;
    font-size: 0.8rem;
}

.tb-muro-acciones {
    display: flex;
    gap: 0.5rem;
}

/* Modal (materiales y muros) */
.tb-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.tb-modal {
    background: white;
    border-radius: 0.65rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    width: 100%;
    max-width: 26rem;
    max-height: 90vh;
    overflow: auto;
}

.tb-modal-ancho {
    max-width: 34rem;
}

.tb-modal-cabecera {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.1rem;
    background: var(--brand);
    color: white;
}

.tb-modal-cabecera h3 {
    margin: 0;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.tb-modal-cabecera .tb-modal-cerrar {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    border-radius: 0.35rem;
    width: 1.5rem;
    height: 1.5rem;
    cursor: pointer;
}

.tb-modal-cuerpo {
    padding: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.tb-modal-cuerpo label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: #475569;
}

.tb-modal-cuerpo input,
.tb-modal-cuerpo select,
.tb-modal-cuerpo textarea {
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 400;
    color: #1e293b;
    border: 1px solid var(--border);
    border-radius: 0.4rem;
    padding: 0.4rem 0.6rem;
}

.tb-modal-cuerpo input[type="color"] {
    padding: 0.2rem;
    height: 2rem;
    width: 4rem;
}

.tb-modal-subtitulo {
    margin: 0.4rem 0 0;
    font-size: 0.8rem;
    color: var(--brand);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.tb-modal-pie {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-top: 0.4rem;
}

.tb-aviso {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #9a3412;
    font-size: 0.78rem;
    padding: 0.6rem 0.8rem;
    border-radius: 0.4rem;
    margin: 0;
}

/* Filas de capas del editor de muros */
.tb-fila-capa {
    display: grid;
    grid-template-columns: 1fr 4.5rem auto auto auto auto;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border);
}

.tb-fila-capa .tb-capa-unidad {
    font-size: 0.75rem;
    color: #94a3b8;
}

.tb-footer {
    text-align: center;
    padding: 0.6rem;
    font-size: 0.7rem;
    color: #94a3b8;
    border-top: 1px solid var(--border);
    background: white;
}

.tb-footer p {
    margin: 0.1rem 0;
}
