.templates-page{min-height:calc(100vh - 112px)}
.templates-shell{max-width:1500px;margin:0 auto}
.templates-layout{display:grid;grid-template-columns:minmax(0,1fr) 294px;gap:18px;align-items:start}
.templates-main{min-width:0}
.templates-hero{min-height:286px;border:1px solid rgba(26,120,182,.42);border-radius:10px;background:
  radial-gradient(circle at 76% 42%,rgba(22,164,255,.30),transparent 19%),
  radial-gradient(circle at 70% 58%,rgba(24,243,190,.18),transparent 24%),
  radial-gradient(circle at 62% 32%,rgba(31,106,255,.23),transparent 28%),
  linear-gradient(118deg,rgba(2,24,53,.98),rgba(3,27,65,.93) 55%,rgba(0,25,59,.96));
position:relative;overflow:hidden;padding:26px 28px;display:flex;align-items:center}
.templates-hero:before{content:"";position:absolute;right:9%;top:48%;width:330px;height:330px;border-radius:50%;transform:translateY(-50%);
background:radial-gradient(circle at 37% 34%,rgba(71,225,255,.5),rgba(12,99,203,.18) 30%,rgba(4,35,82,.3) 54%,rgba(0,12,31,.04) 70%);
border:1px solid rgba(56,205,255,.24);box-shadow:0 0 90px rgba(27,151,255,.23),inset -40px -25px 80px rgba(0,7,34,.55)}
.templates-hero:after{content:"";position:absolute;right:-4%;bottom:-54%;width:760px;height:430px;border:1px solid rgba(68,205,255,.24);border-radius:50%;transform:rotate(-8deg);box-shadow:0 -1px 28px rgba(46,216,255,.12)}
.templates-hero-copy{position:relative;z-index:2;max-width:650px}
.templates-brandline{display:flex;align-items:center;gap:10px;font-size:21px;font-weight:800;margin-bottom:13px}
.templates-brandline span{width:28px;height:28px;border-radius:7px;display:grid;place-items:center;background:linear-gradient(145deg,#0cd8ff,#31f38f);color:#001328;box-shadow:0 0 22px rgba(31,231,215,.28)}
.templates-hero h1{font-size:36px;line-height:1.15;letter-spacing:-1px;margin:18px 0 10px;max-width:620px}
.templates-hero h1 em{font-style:normal;background:var(--uc-gradient-brand);-webkit-background-clip:text;background-clip:text;color:transparent}
.templates-hero p{margin:0;color:#b6cada;font-size:14px;line-height:1.75;max-width:580px}
.templates-hero-actions{display:flex;gap:14px;margin-top:23px;flex-wrap:wrap}
.templates-hero-actions button{height:43px;border-radius:24px;padding:0 22px;font-weight:750;border:1px solid rgba(117,205,236,.65);background:rgba(2,26,52,.72);color:#eaf8ff}
.templates-hero-actions button.primary{border-color:transparent;background:linear-gradient(100deg,#63ff72,#2ce6ba 54%,#18dfff);color:#001b29;box-shadow:0 10px 28px rgba(45,236,178,.2)}
.templates-hero-actions button:hover{transform:translateY(-1px)}

.templates-categories{margin:16px 0 14px;display:grid;grid-template-columns:repeat(8,minmax(0,1fr));gap:9px}
.templates-category{min-height:49px;border:1px solid rgba(40,113,158,.5);border-radius:8px;background:linear-gradient(180deg,rgba(4,31,60,.92),rgba(2,21,44,.96));color:#d7e7f2;display:flex;align-items:center;justify-content:center;gap:8px;font-size:13px}
.templates-category span{font-size:16px;color:#87bfe6}
.templates-category strong{font-weight:650}
.templates-category em{font-style:normal;color:#718da3;font-size:11px}
.templates-category.active{border-color:#18e4ef;background:linear-gradient(90deg,rgba(12,122,163,.5),rgba(4,57,89,.72));box-shadow:0 0 20px rgba(0,222,255,.12);color:#4cf5e5}
.templates-category.active span{color:#27f3db}

.templates-toolbar{display:grid;grid-template-columns:minmax(280px,1fr) 116px 112px 112px;gap:10px;margin-bottom:15px}
.templates-searchbox{height:44px;border:1px solid rgba(35,120,163,.55);border-radius:24px;background:rgba(2,23,48,.9);display:flex;align-items:center;padding-left:16px;overflow:hidden}
.templates-searchbox span{color:#8cb9d2;font-size:20px;margin-right:9px}
.templates-searchbox input{flex:1;min-width:0;border:0;background:transparent;outline:0;color:#eff9ff;font-size:13px}
.templates-searchbox input::placeholder{color:#718da5}
.templates-toolbar button.search{border:0;border-radius:22px;background:linear-gradient(100deg,#42f58d,#1ce0dd,#18c7ff);color:#002238;font-weight:800}
.templates-toolbar select{border:1px solid rgba(35,120,163,.55);border-radius:8px;background:#061b35;color:#d9e9f4;padding:0 10px}

.templates-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:13px}
.template-card{border:1px solid rgba(31,108,154,.54);border-radius:9px;overflow:hidden;background:linear-gradient(180deg,rgba(4,29,58,.95),rgba(2,21,44,.97));box-shadow:0 12px 30px rgba(0,8,22,.18);min-width:0;display:flex;flex-direction:column}
.template-card:hover{border-color:rgba(26,202,222,.8);box-shadow:0 15px 38px rgba(0,18,45,.3),0 0 24px rgba(16,213,231,.08)}
.template-card-cover{height:104px;position:relative;background:
  radial-gradient(circle at 70% 20%,rgba(33,202,255,.25),transparent 30%),
  linear-gradient(135deg,#0a3154,#075473 54%,#10375b);overflow:hidden}
.template-card-cover img{width:100%;height:100%;object-fit:cover;display:block}
.template-card-cover .cover-fallback{height:100%;display:grid;place-items:center;font-size:38px;color:#51f5d7;background:linear-gradient(145deg,rgba(15,124,157,.35),rgba(13,49,92,.3))}
.template-favorite{position:absolute;right:8px;top:8px;width:31px;height:31px;border-radius:50%;border:1px solid rgba(209,238,255,.55);background:rgba(3,29,55,.72);color:#e9f8ff;font-size:18px;display:grid;place-items:center}
.template-favorite.active{color:#ffd65b;border-color:#ffd65b;background:rgba(91,66,4,.6)}
.template-card-body{padding:11px 12px 12px;display:flex;flex-direction:column;flex:1}
.template-card-title{font-size:15px;font-weight:750;margin:0 0 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.template-card-description{font-size:12px;line-height:1.55;color:#a7bfd0;min-height:37px;margin:0 0 9px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.template-card-tags{display:flex;gap:5px;flex-wrap:wrap;margin-bottom:9px}
.template-card-tags span{font-size:10px;padding:3px 8px;border-radius:12px;background:rgba(20,91,135,.5);color:#8bd8ff}
.template-card-footer{display:flex;align-items:center;gap:8px;margin-top:auto}
.template-card-usage{color:#9fb6c9;font-size:11px;margin-right:auto}
.template-card-detail{border:0;background:transparent;color:#7fccef;font-size:11px;padding:4px}
.template-card-use{height:31px;padding:0 12px;border:1px solid #16d8e8;border-radius:9px;background:rgba(4,72,91,.45);color:#63ffe3;font-weight:750;font-size:11px}
.template-card-use:hover{background:rgba(20,118,126,.45)}
.templates-empty{grid-column:1/-1;min-height:250px;border:1px dashed rgba(47,120,163,.45);border-radius:10px;display:grid;place-items:center;text-align:center;color:#7e9db4;background:rgba(2,22,45,.45);padding:30px}
.templates-empty span{font-size:40px;color:#31e5cf}
.templates-empty strong{display:block;color:#dcecf6;margin:10px 0 5px}

.templates-status{margin-top:12px;color:#7896ad;font-size:11px;min-height:18px}
.templates-rail{display:grid;gap:14px}
.template-stat-card,.template-rail-panel{border:1px solid rgba(31,108,154,.48);border-radius:9px;background:linear-gradient(160deg,rgba(4,30,59,.96),rgba(2,19,42,.98));box-shadow:var(--uc-shadow-panel)}
.template-stat-card{height:90px;padding:13px 15px;display:grid;grid-template-columns:46px 1fr auto;align-items:center;gap:11px;text-align:left;color:inherit}
.template-stat-card:hover{border-color:rgba(35,189,218,.72)}
.template-stat-icon{width:43px;height:43px;border-radius:50%;display:grid;place-items:center;font-size:23px;background:rgba(16,91,145,.45);color:#5fd4ff;box-shadow:inset 0 0 18px rgba(35,164,242,.16)}
.template-stat-icon.hot{color:#ff7065;background:rgba(122,47,43,.4)}
.template-stat-icon.favorite{color:#ffd454;background:rgba(112,82,20,.42)}
.template-stat-card small{color:#a7bdd0;display:block;margin-bottom:2px}
.template-stat-card strong{font-size:24px}
.template-stat-card em{font-style:normal;color:#56f2a5;font-size:10px}
.template-rail-panel{padding:13px 14px}
.template-rail-header{display:flex;align-items:center;justify-content:space-between;padding-bottom:10px;border-bottom:1px solid rgba(60,116,151,.22)}
.template-rail-header h2{margin:0;font-size:13px}
.template-rail-header button{border:0;background:transparent;color:#23dcec;font-size:10px}
.template-side-list{display:grid;margin-top:7px}
.template-side-item{display:grid;grid-template-columns:33px minmax(0,1fr) auto;gap:8px;align-items:center;padding:8px 0;border-bottom:1px solid rgba(50,101,136,.15);cursor:pointer}
.template-side-item:last-child{border-bottom:0}
.template-side-thumb{width:31px;height:31px;border-radius:7px;background:linear-gradient(145deg,#0b5a87,#14bba4);display:grid;place-items:center;color:#eafffb;font-size:13px;overflow:hidden}
.template-side-thumb img{width:100%;height:100%;object-fit:cover}
.template-side-item strong{display:block;font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.template-side-item small{color:#7897af;font-size:9px}
.template-side-meta{font-size:9px;color:#94adc0;white-space:nowrap}
.template-rank{width:22px;height:22px;border-radius:50%;display:grid;place-items:center;background:#0d365a;color:#b9d4e7;font-size:10px}
.template-rank.top{background:linear-gradient(145deg,#f5c63d,#f08c23);color:#fff}

.templates-dialog{padding:0;border:1px solid rgba(51,154,199,.48);border-radius:12px;background:#03172f;color:#fff;width:min(820px,calc(100vw - 30px));max-height:90vh;box-shadow:0 28px 100px rgba(0,0,0,.65)}
.templates-dialog::backdrop{background:rgba(0,7,18,.76);backdrop-filter:blur(3px)}
.templates-dialog-head{display:flex;align-items:center;justify-content:space-between;padding:16px 18px;border-bottom:1px solid rgba(72,134,172,.23)}
.templates-dialog-head h2{margin:0;font-size:18px}
.templates-dialog-head button{border:0;background:transparent;color:#9db7ca;font-size:24px}
.templates-dialog-body{padding:18px;overflow:auto;max-height:calc(90vh - 62px)}
.templates-form-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.templates-form-row{display:grid;gap:6px}
.templates-form-row.wide{grid-column:1/-1}
.templates-form-row label{color:#9fb7c9;font-size:11px}
.templates-form-row input,.templates-form-row select,.templates-form-row textarea{width:100%;border:1px solid rgba(39,117,160,.55);border-radius:7px;background:#061d39;color:#edf8ff;padding:9px 10px}
.templates-form-row textarea{min-height:76px;resize:vertical}
.templates-dialog-note{padding:10px 12px;border-left:3px solid #1cd4df;background:rgba(7,61,85,.34);color:#91b2c6;font-size:11px;line-height:1.55;margin-bottom:14px}
.template-field-builder{margin-top:15px;border:1px solid rgba(39,112,155,.34);border-radius:8px;overflow:hidden}
.template-field-head{display:flex;align-items:center;justify-content:space-between;padding:10px 12px;background:rgba(8,46,76,.5)}
.template-field-head strong{font-size:12px}
.template-field-head button{border:1px solid rgba(55,160,190,.5);background:#082a49;color:#5af0d4;border-radius:6px;padding:6px 10px}
.template-field-rows{display:grid}
.template-field-row{display:grid;grid-template-columns:1fr 1fr 110px 1.2fr auto;gap:7px;padding:9px;border-top:1px solid rgba(47,105,140,.2)}
.template-field-row input,.template-field-row select{min-width:0;border:1px solid rgba(40,106,147,.45);border-radius:6px;background:#051b35;color:#e9f5ff;padding:8px}
.template-field-row button{border:0;background:transparent;color:#ff8d8d;padding:0 8px}
.templates-dialog-actions{display:flex;justify-content:flex-end;gap:9px;margin-top:16px}
.templates-dialog-actions button,.templates-dialog-actions a{min-height:38px;padding:0 15px;border:1px solid rgba(45,125,166,.6);border-radius:7px;background:#08233f;color:#d7eaf5;display:inline-flex;align-items:center;justify-content:center}
.templates-dialog-actions .primary{border-color:transparent;background:var(--uc-gradient-brand);color:#002235;font-weight:800}
.template-detail-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.template-detail-grid>div{padding:10px;border:1px solid rgba(40,111,153,.3);border-radius:7px;background:rgba(4,30,56,.5)}
.template-detail-grid small{display:block;color:#7596af;margin-bottom:4px}
.template-detail-grid strong{display:block;color:#edf7ff;word-break:break-word}
.template-detail-fields,.template-detail-params{display:flex;gap:6px;flex-wrap:wrap}
.template-detail-fields span,.template-detail-params span{padding:4px 8px;border-radius:12px;background:rgba(16,85,127,.5);color:#8edaff;font-size:10px}
.template-tour-steps{display:grid;gap:10px}
.template-tour-step{display:grid;grid-template-columns:36px 1fr;gap:12px;padding:12px;border:1px solid rgba(40,111,153,.3);border-radius:8px;background:rgba(3,28,53,.58)}
.template-tour-step span{width:34px;height:34px;border-radius:50%;display:grid;place-items:center;background:linear-gradient(145deg,#10cbd9,#40ef94);color:#002034;font-weight:900}
.template-tour-step strong{display:block;margin-bottom:4px}
.template-tour-step p{margin:0;color:#8eacbf;font-size:11px;line-height:1.55}

@media(max-width:1320px){
  .templates-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
  .templates-categories{grid-template-columns:repeat(4,minmax(0,1fr))}
}
@media(max-width:1100px){
  .templates-layout{grid-template-columns:1fr}
  .templates-rail{grid-template-columns:repeat(3,1fr)}
  .template-rail-panel{grid-column:span 3}
}
@media(max-width:860px){
  .templates-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .templates-toolbar{grid-template-columns:1fr 100px}
  .templates-toolbar select{min-height:40px}
  .templates-hero:before,.templates-hero:after{opacity:.45}
  .templates-hero-copy{max-width:70%}
  .templates-rail{grid-template-columns:1fr 1fr}
  .template-stat-card{height:80px}
  .template-rail-panel{grid-column:span 2}
}
@media(max-width:600px){
  .templates-grid{grid-template-columns:1fr}
  .templates-categories{grid-template-columns:repeat(2,minmax(0,1fr))}
  .templates-toolbar{grid-template-columns:1fr}
  .templates-hero{padding:22px 18px;min-height:265px}
  .templates-hero-copy{max-width:100%}
  .templates-hero:before{right:-38%;opacity:.26}
  .templates-hero h1{font-size:29px}
  .templates-rail{grid-template-columns:1fr}
  .template-rail-panel{grid-column:auto}
  .templates-form-grid{grid-template-columns:1fr}
  .templates-form-row.wide{grid-column:auto}
  .template-field-row{grid-template-columns:1fr 1fr}
}
