/* لوحة تترا */
.tetra-panel{font-family:"Cairo",-apple-system,"Segoe UI",Tahoma,sans-serif;max-width:1280px;color:#111827}
.tetra-panel *{box-sizing:border-box}
.tp-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:10px 0 18px}
.tp-head h1{font-size:26px;font-weight:800;margin:0;padding:0}
.tp-tabs{display:flex;gap:8px;flex-wrap:wrap;border-bottom:1px solid #e5e7eb;margin-bottom:18px}
.tp-tab{background:none;border:0;border-bottom:3px solid transparent;padding:10px 16px;font-size:15px;font-weight:700;cursor:pointer;color:#6b7280;font-family:inherit}
.tp-tab.active{color:#e11d30;border-bottom-color:#e11d30}
.tp-pane{display:none}.tp-pane.active{display:block}
.tp-loading,.tp-empty{padding:40px;text-align:center;color:#6b7280;font-size:15px}
.tp-toolbar{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin:0 0 14px}
.tp-search{flex:1;min-width:200px;max-width:360px;padding:9px 14px!important;border-radius:10px!important;border:1px solid #d1d5db!important}
.tp-btn{background:#e11d30;color:#fff;border:0;border-radius:10px;padding:9px 18px;font-weight:700;font-size:14px;cursor:pointer;font-family:inherit;text-decoration:none;display:inline-block}
.tp-btn:hover{opacity:.9;color:#fff}.tp-btn:disabled{opacity:.6;cursor:wait}
.tp-btn-ghost{background:#fff;color:#111827;border:1px solid #d1d5db}.tp-btn-ghost:hover{color:#111827}
.tp-btn-save{background:#16a34a}
.tp-link{color:#2563eb;text-decoration:none;font-weight:600}
.tp-pills{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:16px}
.tp-pill{background:#f3f4f6;border:1px solid #e5e7eb;border-radius:999px;padding:6px 14px;font-size:13px;font-weight:700;cursor:pointer;font-family:inherit}
.tp-pill.active{background:#111827;color:#fff;border-color:#111827}
.tp-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(330px,1fr));gap:14px}
.tp-card{background:#fff;border:1px solid #e5e7eb;border-radius:14px;display:flex;gap:12px;padding:12px;transition:box-shadow .2s}
.tp-card.dirty{box-shadow:0 0 0 2px #fbbf24}
.tp-card.is-hidden{opacity:.6;background:#fafafa}
.tp-img{width:96px;height:96px;flex:0 0 96px;border-radius:12px;background:#f3f4f6;display:flex;align-items:center;justify-content:center;cursor:pointer;overflow:hidden;border:1px dashed #d1d5db;color:#6b7280;font-size:13px}
.tp-img img{width:100%;height:100%;object-fit:cover}
.tp-body{flex:1;min-width:0;display:flex;flex-direction:column;gap:8px}
.tp-body label,.tp-fields label,.tp-branch-grid label{display:flex;flex-direction:column;gap:4px;font-size:12px;font-weight:700;color:#4b5563}
.tp-body input,.tp-body textarea,.tp-body select,.tp-fields input,.tp-branch-grid input{width:100%;max-width:none;padding:7px 10px;border:1px solid #d1d5db;border-radius:8px;font-size:14px;font-family:inherit}
.tp-row2{display:grid;grid-template-columns:1fr 1fr;gap:8px;align-items:end}
.tp-switch{flex-direction:row!important;align-items:center;gap:8px!important;font-size:13px!important;cursor:pointer}
.tp-switch input{width:auto!important}
.tp-switch.wide{padding:4px 0}
.tp-vars{background:#f9fafb;border-radius:10px;padding:8px}
.tp-vars-title{font-size:12px;font-weight:800;color:#4b5563;margin-bottom:6px}
.tp-var{display:grid;grid-template-columns:1fr 90px 80px;gap:6px;align-items:center;margin-bottom:5px;font-size:13px}
.tp-var input{padding:5px 8px;border:1px solid #d1d5db;border-radius:7px;width:100%}
.tp-actions{display:flex;align-items:center;gap:12px;margin-top:2px}
.tp-del{background:none;border:0;color:#dc2626;cursor:pointer;font-weight:700;font-family:inherit;margin-inline-start:auto}
.tp-mini{background:#f3f4f6;border:1px solid #e5e7eb;border-radius:6px;width:28px;height:28px;cursor:pointer}
.tp-branch{background:#fff;border:1px solid #e5e7eb;border-radius:14px;padding:14px;margin-bottom:12px}
.tp-branch-head{display:flex;align-items:center;gap:8px;margin-bottom:10px;font-size:15px}
.tp-branch-head small{color:#6b7280}
.tp-branch-tools{margin-inline-start:auto;display:flex;gap:6px;align-items:center}
.tp-branch-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:10px}
.tp-hint{color:#6b7280;font-size:12px;margin:8px 0 0}
.tp-box{background:#fff;border:1px solid #e5e7eb;border-radius:14px;padding:16px;margin-bottom:14px}
.tp-box h3{margin:0 0 12px;font-size:16px}
.tp-fields{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:12px}
.tp-color span{display:flex;align-items:center;gap:10px}
.tp-color input[type=color]{width:56px;height:40px;padding:2px;border-radius:8px;border:1px solid #d1d5db;cursor:pointer}
.tp-toast{position:fixed;bottom:24px;left:50%;transform:translateX(-50%) translateY(20px);background:#111827;color:#fff;padding:12px 22px;border-radius:12px;font-weight:700;opacity:0;pointer-events:none;transition:.25s;z-index:99999}
.tp-toast.show{opacity:1;transform:translateX(-50%) translateY(0)}
.tp-toast.bad{background:#dc2626}
@media (max-width:600px){.tp-card{flex-direction:column}.tp-img{width:100%;height:160px;flex-basis:auto}.tp-grid{grid-template-columns:1fr}}

.tp-catbar{display:flex;align-items:center;gap:12px;flex-wrap:wrap;background:#fff;border:1px solid #e5e7eb;border-radius:12px;padding:10px 14px;margin:-6px 0 14px}
.tp-catbar .tp-del{margin-inline-start:0}

.tp-storebar{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;background:#f0fdf4;border:1px solid #bbf7d0;border-radius:14px;padding:12px 16px;margin-bottom:14px}
.tp-storebar.is-off{background:#fef2f2;border-color:#fecaca}
.tp-storebar small{display:block;color:#6b7280;font-weight:600}

.hm-preview{margin-bottom:12px}
.hm-preview video{width:100%;max-width:420px;border-radius:14px;display:block;background:#000}
.hm-link{background:#f3f4f6;border-radius:10px;padding:10px;word-break:break-all}
.hm-item{display:flex;gap:12px;align-items:flex-start;background:#fafafa;border:1px solid #e5e7eb;border-radius:12px;padding:10px;margin-bottom:10px}
.hm-thumb{width:160px;flex:0 0 160px;aspect-ratio:16/7;border-radius:10px;background:#e5e7eb;overflow:hidden;display:flex;align-items:center;justify-content:center;cursor:pointer;color:#6b7280;font-weight:700;font-size:13px}
.hm-thumb img,.hm-thumb video{width:100%;height:100%;object-fit:cover}
.hm-thumb.hm-reel{width:90px;flex-basis:90px;aspect-ratio:9/16;cursor:default}
.hm-body{flex:1;min-width:0;display:flex;flex-direction:column;gap:6px}
.hm-link-row{display:flex;gap:8px;flex-wrap:wrap}
.hm-link-row select,.hm-link-row input{flex:1;min-width:150px;padding:7px 10px;border:1px solid #d1d5db;border-radius:8px}
.hm-tools{display:flex;flex-direction:column;gap:6px;align-items:center}
.hm-tools .tp-del{margin:0}
.hm-progress{font-weight:700;color:#2563eb}
.hm-save-bar{position:sticky;bottom:0;background:#f6f7f9;padding:10px 0;z-index:3}
#hm-save.pulse{box-shadow:0 0 0 3px rgba(22,163,74,.35)}
@media(max-width:600px){.hm-item{flex-wrap:wrap}.hm-thumb{width:100%;flex-basis:100%}}

.hm-dim{background:#fafafa;border:1px solid #e5e7eb;border-radius:12px;padding:12px;margin-bottom:12px;position:relative}
.hm-dim-row{display:flex;align-items:center;gap:10px;font-weight:700;font-size:13px}
.hm-dim-row input{flex:1}
.hm-dim-preview{position:absolute;inset:0;border-radius:12px;pointer-events:none;display:none}

.tp-spec{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:6px 14px;background:#f0f9ff;border:1px solid #bae6fd;border-radius:12px;padding:10px 14px;margin:6px 0 14px;font-size:13px}
.tp-spec div{display:flex;flex-direction:column;gap:1px}
.tp-spec span{color:#0369a1;font-weight:700;font-size:12px}
.tp-spec b{color:#0f172a;font-weight:700}
