/* Teefit Designer */
*{box-sizing:border-box}
html,body{margin:0;padding:0;background:#fff;color:#222;font:14px/1.45 Roboto,"Segoe UI",Arial,sans-serif}
button,input,select,textarea{font:inherit;color:inherit}
button{cursor:pointer}
.tfd-boot{padding:80px 20px;text-align:center;color:#888}
:root{--tfd-accent:#0f9d84;--tfd-accent-d:#0b7d69;--tfd-buy:#f26522;--tfd-line:#dcdfe3;--tfd-soft:#f5f7f8}

.tfd{display:grid;grid-template-columns:270px minmax(0,1fr) 280px;grid-template-rows:auto auto;grid-template-areas:"top top top" "left stage right";align-items:start;align-content:start;gap:0 22px;max-width:1440px;margin:0 auto;padding:12px 18px 24px;min-height:100vh}
.tfd-top{grid-area:top;display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding-bottom:12px}
.tfd-logo{display:flex;align-items:center;gap:8px;text-decoration:none;color:#111;font-weight:700;font-size:18px;margin-right:6px}
.tfd-logo img{height:34px;width:auto}
.tfd-spacer{flex:1}
.tfd-btn{text-decoration:none;color:#222;display:inline-flex;align-items:center;gap:6px;border:1px solid var(--tfd-line);background:#fff;border-radius:4px;padding:7px 13px;font-size:14px;line-height:1.2;transition:background .15s,border-color .15s}
.tfd-btn:hover{background:var(--tfd-soft);border-color:#c4c9ce}
.tfd-btn[disabled]{opacity:.45;cursor:default}
.tfd-btn svg{width:16px;height:16px;flex:none}
.tfd-btn.is-on{background:#e6f5f2;border-color:var(--tfd-accent);color:var(--tfd-accent-d)}

/* cột trái */
.tfd-left{grid-area:left;display:flex;flex-direction:column;gap:16px;min-width:0}
.tfd-menu{border:1px solid var(--tfd-line);border-radius:4px;overflow:hidden}
.tfd-menu button{display:flex;align-items:center;gap:12px;width:100%;border:0;border-top:1px solid var(--tfd-line);background:#fff;padding:13px 14px;font-size:16px;text-align:left}
.tfd-menu button:first-child{border-top:0}
.tfd-menu button:hover{background:var(--tfd-soft)}
.tfd-menu button.is-active{background:#e6f5f2;color:var(--tfd-accent-d);font-weight:500}
.tfd-menu svg{width:21px;height:21px;flex:none;color:#444}
.tfd-menu button.is-active svg{color:var(--tfd-accent)}
.tfd-panel{border:1px solid var(--tfd-line);border-radius:4px;padding:14px;display:none}
.tfd-panel.is-open{display:block}
.tfd-panel h3{margin:0 0 10px;font-size:15px;font-weight:600;display:flex;align-items:center;justify-content:space-between}
.tfd-panel h3 button{border:0;background:none;font-size:20px;line-height:1;color:#888;padding:0 2px}
.tfd-field{margin:0 0 11px}
.tfd-field>label{display:block;font-size:12.5px;color:#666;margin-bottom:4px}
.tfd-field textarea,.tfd-field select,.tfd-field input[type=text],.tfd-field input[type=number]{width:100%;border:1px solid var(--tfd-line);border-radius:4px;padding:8px 9px;background:#fff}
.tfd-field textarea{resize:vertical;min-height:62px}
.tfd-row{display:flex;gap:8px;align-items:center}
.tfd-row>*{flex:1}
.tfd-toggle{display:flex;gap:4px}
.tfd-toggle button{flex:1;border:1px solid var(--tfd-line);background:#fff;border-radius:4px;padding:6px 0;font-weight:600}
.tfd-toggle button.is-on{background:var(--tfd-accent);border-color:var(--tfd-accent);color:#fff}
.tfd-colorinput{display:flex;align-items:center;gap:8px}
.tfd-colorinput input[type=color]{width:38px;height:32px;border:1px solid var(--tfd-line);border-radius:4px;padding:2px;background:#fff}
.tfd-mini-swatches{display:flex;flex-wrap:wrap;gap:4px}
.tfd-mini-swatches button{width:20px;height:20px;border-radius:3px;border:1px solid rgba(0,0,0,.18);padding:0}
.tfd-primary{width:100%;border:0;border-radius:4px;background:var(--tfd-accent);color:#fff;padding:10px;font-weight:600;font-size:15px}
.tfd-primary:hover{background:var(--tfd-accent-d)}
.tfd-hint{font-size:12.5px;color:#777;margin:6px 0 0}
.tfd-warn{font-size:12.5px;color:#b45309;background:#fff7ed;border:1px solid #fed7aa;border-radius:4px;padding:7px 9px;margin:8px 0 0}
.tfd-products{display:grid;grid-template-columns:1fr;gap:8px}
.tfd-product{display:flex;gap:10px;align-items:center;border:1px solid var(--tfd-line);border-radius:4px;padding:6px;background:#fff;text-align:left}
.tfd-product.is-on{border-color:var(--tfd-accent);box-shadow:0 0 0 1px var(--tfd-accent)}
.tfd-product img{width:54px;height:54px;object-fit:contain;background:var(--tfd-soft);border-radius:3px}
.tfd-product b{display:block;font-weight:500}
.tfd-product span{color:#666;font-size:13px}
.tfd-clips{display:grid;grid-template-columns:repeat(4,1fr);gap:6px}
.tfd-clips button{height:56px;border:1px solid var(--tfd-line);border-radius:4px;background:#fff;padding:9px;display:flex;align-items:center;justify-content:center}
.tfd-clips button:hover{border-color:var(--tfd-accent)}
.tfd-clips svg{width:36px;height:36px;fill:#333}
.tfd-drop{display:block;border:2px dashed #c8cdd2;border-radius:6px;padding:20px 10px;text-align:center;color:#555;cursor:pointer}
.tfd-drop:hover,.tfd-drop.is-over{border-color:var(--tfd-accent);background:#f2fbf9}
.tfd-drop input{display:none}
.tfd-saved{display:grid;grid-template-columns:repeat(2,1fr);gap:8px}
.tfd-saved figure{margin:0;border:1px solid var(--tfd-line);border-radius:4px;padding:5px;position:relative;cursor:pointer;background:#fff}
.tfd-saved img{width:100%;aspect-ratio:1;object-fit:contain;background:var(--tfd-soft)}
.tfd-saved figcaption{font-size:12px;color:#555;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tfd-saved .tfd-x{position:absolute;top:3px;right:3px;border:0;background:rgba(0,0,0,.55);color:#fff;border-radius:50%;width:20px;height:20px;line-height:20px;padding:0;font-size:13px}

.tfd-layers{border:1px solid var(--tfd-line);border-radius:4px}
.tfd-layers>button{display:flex;width:100%;justify-content:space-between;align-items:center;border:0;background:#fff;padding:12px 14px;font-size:16px}
.tfd-layers ul{list-style:none;margin:0;padding:0;border-top:1px solid var(--tfd-line);max-height:260px;overflow:auto}
.tfd-layers.is-closed ul{display:none}
.tfd-layers li{display:flex;align-items:center;gap:8px;padding:7px 10px;border-top:1px solid #eef0f2;cursor:pointer;font-size:13.5px}
.tfd-layers li:first-child{border-top:0}
.tfd-layers li.is-on{background:#e6f5f2}
.tfd-layers li .tfd-lname{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tfd-layers li button{border:0;background:none;padding:2px;color:#777}
.tfd-layers li button:hover{color:#111}
.tfd-layers li svg{width:15px;height:15px;display:block}
.tfd-layers .tfd-empty{color:#999;cursor:default;padding:12px}

/* giữa */
.tfd-center{grid-area:stage;display:flex;flex-direction:column;min-width:0}
.tfd-stagewrap{display:flex;justify-content:center;align-items:flex-start;gap:14px;min-width:0;position:relative}
.tfd-stage{position:relative;flex:0 1 auto;min-width:0}
.tfd-stage .canvas-container{margin:0 auto}
.tfd-tools{display:flex;flex-direction:column;border:1px solid var(--tfd-line);border-radius:4px;align-self:center;background:#fff}
.tfd-tools button{width:46px;height:40px;border:0;border-top:1px solid var(--tfd-line);background:#fff;display:flex;align-items:center;justify-content:center;color:#333}
.tfd-tools button:first-child{border-top:0}
.tfd-tools button:hover{background:var(--tfd-soft)}
.tfd-tools button[disabled]{color:#c3c7cb;cursor:default;background:#fff}
.tfd-tools svg{width:18px;height:18px}
.tfd-views{display:flex;justify-content:center;gap:10px;padding-top:10px}
.tfd-view{border:1px solid var(--tfd-line);border-radius:4px;background:#fff;padding:4px;width:78px;text-align:center;font-size:12px;color:#555}
.tfd-view canvas,.tfd-view img{display:block;width:68px;height:68px;object-fit:contain;margin:0 auto 2px}
.tfd-view.is-on{border-color:var(--tfd-accent);box-shadow:0 0 0 1px var(--tfd-accent);color:var(--tfd-accent-d)}
.tfd-view .tfd-dot{display:inline-block;width:6px;height:6px;border-radius:50%;background:var(--tfd-buy);margin-left:4px;vertical-align:middle}

/* cột phải */
.tfd-right{grid-area:right;min-width:0}
.tfd-box{border:1px solid var(--tfd-line);border-radius:4px;background:#fff}
.tfd-box-h{display:flex;justify-content:space-between;align-items:center;width:100%;border:0;border-bottom:1px solid var(--tfd-line);background:#fff;padding:12px 14px;font-size:17px;text-align:left}
.tfd-box-b{padding:12px 14px}
.tfd-sub{font-size:13.5px;font-weight:600;color:#555;margin:0 0 7px}
.tfd-swatches{display:grid;grid-template-columns:repeat(6,1fr);gap:6px;margin-bottom:14px}
.tfd-swatches button{aspect-ratio:1;border:1px solid rgba(0,0,0,.15);border-radius:3px;padding:0;position:relative}
.tfd-swatches button.is-on{outline:2px solid var(--tfd-buy);outline-offset:2px}
.tfd-colorname{font-size:13px;color:#666;margin:-8px 0 12px}
.tfd-sizes{display:grid;grid-template-columns:repeat(4,1fr);gap:8px 10px;margin-bottom:14px}
.tfd-sizes label{display:flex;flex-direction:column;align-items:center;font-size:13px;font-weight:600;color:#555;gap:3px}
.tfd-sizes input{width:100%;border:1px solid var(--tfd-line);border-radius:4px;padding:6px 4px;text-align:center}
.tfd-sizes input.has-qty{border-color:var(--tfd-accent);background:#f2fbf9}
.tfd-sizelink{font-size:13px;color:var(--tfd-accent-d);background:none;border:0;padding:0;text-decoration:underline;text-align:left}
.tfd-sizechart img{display:block;width:100%;max-width:880px;margin:0 auto;height:auto}
.tfd-swatches{grid-template-columns:repeat(4,1fr)!important}
.tfd-swatches button{aspect-ratio:auto!important;height:38px}
.tfd-price{border-top:1px solid var(--tfd-line);padding-top:12px;font-size:13.5px}
.tfd-price div{display:flex;justify-content:space-between;margin:3px 0;color:#555}
.tfd-price .tfd-total{font-size:17px;color:#111;font-weight:700;margin-top:8px}
.tfd-buy{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;margin-top:12px;border:0;border-radius:4px;background:var(--tfd-buy);color:#fff;font-weight:700;font-size:16px;padding:12px}
.tfd-buy:hover{background:#d9541a}
.tfd-buy[disabled]{opacity:.6;cursor:progress}
.tfd-buy svg{width:20px;height:20px}
.tfd-help{font-size:12.5px;color:#666;margin:10px 0 0;text-align:center}
.tfd-help a{color:var(--tfd-accent-d)}

/* hộp thoại */
.tfd-modal{position:fixed;inset:0;background:rgba(17,24,39,.55);display:flex;align-items:center;justify-content:center;z-index:50;padding:16px}
.tfd-modal-box{background:#fff;border-radius:8px;max-width:920px;width:100%;max-height:92vh;overflow:auto;padding:18px;position:relative}
.tfd-modal-box h2{margin:0 0 12px;font-size:18px}
.tfd-modal-close{position:absolute;top:8px;right:10px;border:0;background:none;font-size:26px;color:#777}
.tfd-previews{display:flex;gap:16px;flex-wrap:wrap;justify-content:center}
.tfd-previews figure{margin:0;text-align:center;flex:1 1 280px}
.tfd-previews img{width:100%;max-width:420px;background:#fff}
.tfd-toast{position:fixed;left:50%;bottom:24px;transform:translateX(-50%);background:#1f2937;color:#fff;padding:10px 16px;border-radius:6px;z-index:60;font-size:14px;max-width:90vw;box-shadow:0 6px 24px rgba(0,0,0,.2)}
.tfd-toast.is-err{background:#b91c1c}

/* điện thoại / máy tính bảng */
@media (max-width:1100px){
  .tfd{grid-template-columns:240px minmax(0,1fr) 250px;gap:0 14px;padding:10px 12px 20px}
}
@media (max-width:860px){
  .tfd{display:flex;flex-direction:column;padding:8px 10px 90px;gap:10px}
  .tfd-top{padding-bottom:0;gap:6px}
  .tfd-top .tfd-btn{padding:6px 9px;font-size:13px}
  .tfd-top .tfd-btn .tfd-lbl{display:none}
  .tfd-top .tfd-btn{padding:7px 8px}
  .tfd-top .tfd-btn:last-child{display:none}
  .tfd-stage{align-self:center}
  .tfd-logo img{height:28px}
  .tfd-center{order:1}
  .tfd-stagewrap{flex-direction:column;align-items:center}
  .tfd-tools{flex-direction:row;align-self:center;flex-wrap:wrap;justify-content:center}
  .tfd-tools button{border-top:0;border-left:1px solid var(--tfd-line);width:40px;height:38px}
  .tfd-tools button:first-child{border-left:0}
  .tfd-views{padding-top:8px}
  .tfd-left{order:3}
  .tfd-menu{display:grid;grid-template-columns:repeat(5,1fr)}
  .tfd-menu button{flex-direction:column;gap:4px;font-size:11.5px;padding:9px 2px;text-align:center;border-top:0;border-left:1px solid var(--tfd-line);line-height:1.2}
  .tfd-menu button:first-child{border-left:0}
  .tfd-right{order:4}
  .tfd-buybar{position:fixed;left:0;right:0;bottom:0;background:#fff;border-top:1px solid var(--tfd-line);padding:8px 12px;display:flex;align-items:center;gap:10px;z-index:40}
  .tfd-buybar .tfd-buy{margin:0;flex:1;padding:11px}
  .tfd-buybar .tfd-bb-total{font-weight:700;font-size:16px}
}
@media (min-width:861px){.tfd-buybar{display:none}}

/* khung tiến trình đặt hàng */
.tfd-busy{position:fixed;inset:0;z-index:70;background:rgba(17,24,39,.55);display:flex;align-items:center;justify-content:center;padding:16px}
.tfd-busy-box{background:#fff;border-radius:10px;padding:26px 24px 22px;width:100%;max-width:380px;text-align:center;box-shadow:0 12px 40px rgba(0,0,0,.25)}
.tfd-spin{width:44px;height:44px;margin:0 auto 14px;border:4px solid #e6f5f2;border-top-color:var(--tfd-accent);border-radius:50%;animation:tfdspin .9s linear infinite}
@keyframes tfdspin{to{transform:rotate(360deg)}}
.tfd-busy-title{font-size:17px;font-weight:700;margin-bottom:6px}
.tfd-busy-step{font-size:14px;color:#444;min-height:20px}
.tfd-bar{height:8px;background:#eef0f2;border-radius:6px;overflow:hidden;margin:14px 0 10px}
.tfd-bar i{display:block;height:100%;width:3%;background:var(--tfd-accent);border-radius:6px;transition:width .3s}
.tfd-busy-note{font-size:12.5px;color:#888}
