.template_center_view{
  display:none;
  flex:1;
  min-width:0;
  min-height:0;
  padding:0;
}

.template_center_view.active{
  display:flex;
}

.template_center_shell{
  flex:1;
  min-width:0;
  min-height:0;
  display:flex;
  flex-direction:column;
  gap:10px;
  padding:18px 18px 0;
  background:#f7f8fa;
  color:#111827;
  overflow:hidden;
}

.template_center_panel h2,
.template_category_dialog h2{
  margin:0;
  color:#111827;
  letter-spacing:0;
}

.template_center_panel p,
.template_category_dialog p,
.template_detail_note{
  margin:6px 0 0;
  color:#6b7280;
  font-size:13px;
  line-height:1.45;
}

.template_center_btn,
.template_icon_btn,
.template_status_tabs button{
  height:36px;
  border:1px solid #d1d5db;
  border-radius:8px;
  background:#ffffff;
  color:#374151;
  font-size:12px;
  font-weight:700;
  padding:0 14px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  white-space:nowrap;
  cursor:pointer;
}

.template_center_btn:hover,
.template_icon_btn:hover,
.template_status_tabs button:hover{
  background:#f9fafb;
}

.template_center_btn.is-primary{
  background:#2563eb;
  border-color:#2563eb;
  color:#ffffff;
}

.template_center_btn.is-danger{
  color:#dc2626;
}

.template_icon_btn{
  height:28px;
  padding:0 12px;
}

.template_detail_edit_btn{
  align-self:flex-start;
  height:28px;
  min-width:52px;
  padding:0 12px;
}

.template_detail_header_actions{
  display:flex;
  align-items:center;
  gap:6px;
}

.template_detail_preview_btn{
  gap:5px;
  min-width:62px;
  border-color:#bfdbfe;
  background:#eff6ff;
  color:#1d4ed8;
}

.template_detail_preview_btn:hover:not(:disabled){
  border-color:#93c5fd;
  background:#dbeafe;
}

.template_detail_preview_btn svg{
  width:15px;
  height:15px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.8;
  stroke-linecap:round;
  stroke-linejoin:round;
}

.template_detail_preview_btn:disabled{
  border-color:#e5e7eb;
  background:#f9fafb;
  color:#9ca3af;
  cursor:not-allowed;
  opacity:.75;
}

.template_center_main{
  flex:1;
  min-height:0;
  display:grid;
  grid-template-columns:170px minmax(430px, 1.1fr) minmax(320px, .9fr);
  gap:10px;
  overflow:hidden;
}

.template_center_panel{
  min-width:0;
  min-height:0;
  border:1px solid #e8eaee;
  border-radius:8px;
  background:#ffffff;
  display:flex;
  flex-direction:column;
  overflow:hidden;
}

.panel_header{
  flex:0 0 auto;
  min-height:58px;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  padding:12px 14px 10px;
  border-bottom:1px solid #eef0f3;
}

.template_center_panel h2{
  font-size:15px;
  line-height:1.3;
  font-weight:760;
}

.template_category_tree{
  flex:1;
  min-height:0;
  overflow:auto;
  padding:6px 8px 10px;
}

.category_node{
  width:100%;
  min-height:31px;
  display:grid;
  grid-template-columns:auto 1fr auto;
  align-items:center;
  gap:8px;
  border:1px solid transparent;
  border-radius:6px;
  background:#ffffff;
  color:#374151;
  padding:0 8px;
  margin-top:2px;
  cursor:pointer;
  text-align:left;
}

.category_node:hover{
  background:#f9fafb;
}

.category_node.is-sortable{
  cursor:grab;
}

.category_node.is-category-dragging{
  opacity:.55;
}

.category_node[data-drop-target="1"].is-drop-target{
  border-color:#2563eb;
  background:#dbeafe;
  color:#1d4ed8;
  box-shadow:inset 0 0 0 1px #2563eb;
}

.category_node.is-sort-before,
.category_node.is-sort-after{
  border-color:#2563eb;
}

.category_node.is-sort-before{
  box-shadow:0 -2px 0 #2563eb;
}

.category_node.is-sort-after{
  box-shadow:0 2px 0 #2563eb;
}

.category_node.is-active{
  border-color:#bfdbfe;
  background:#eff6ff;
  color:#1d4ed8;
}

.category_node.is-child{
  width:calc(100% - 10px);
  margin-left:10px;
}

.category_marker{
  width:2px;
  height:18px;
  border-radius:2px;
  background:#e5e7eb;
}

.category_node.is-active .category_marker{
  background:#2563eb;
}

.category_name{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:13px;
  font-weight:650;
}

.category_count{
  color:#9ca3af;
  font-size:12px;
}

.template_category_editor{
  display:none;
}

.editor_title{
  color:#6b7280;
  font-size:12px;
  font-weight:760;
  margin-bottom:10px;
}

.editor_actions{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
}

.editor_actions .is-danger{
  grid-column:1 / -1;
}

.template_status_tabs{
  display:flex;
  align-items:center;
  gap:8px;
}

.template_list_header_actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
  flex-wrap:wrap;
  min-width:0;
}

.template_status_tabs button{
  height:28px;
  border-radius:999px;
  background:#f9fafb;
  color:#6b7280;
  padding:0 12px;
}

.template_status_tabs button.is-active{
  background:#111827;
  border-color:#111827;
  color:#ffffff;
}

.template_list{
  flex:1;
  min-height:0;
  overflow:auto;
  padding:0 10px 10px;
}

.template_row{
  width:100%;
  min-height:54px;
  display:grid;
  grid-template-columns:18px minmax(0, 1fr) 68px 64px 48px;
  align-items:center;
  gap:8px;
  border:0;
  border-bottom:1px solid #eef0f3;
  background:#ffffff;
  padding:7px 4px 7px 12px;
  cursor:pointer;
  text-align:left;
  box-shadow:inset 0 0 0 0 transparent;
}

.template_row:hover{
  background:#f9fafb;
}

.template_row.is-dragging{
  opacity:.58;
}

.template_row.is-active{
  background:#eff6ff;
  box-shadow:inset 3px 0 0 #2563eb;
}

.template_row.is-active .template_row_title{
  color:#1d4ed8;
}

.template_row_check{
  width:16px;
  height:16px;
  border:1px solid #d1d5db;
  border-radius:4px;
  background:#ffffff;
  position:relative;
}

.template_row.is-active .template_row_check{
  border-color:#2563eb;
  background:#2563eb;
}

.template_row.is-active .template_row_check::after{
  content:"";
  position:absolute;
  left:4px;
  top:1px;
  width:5px;
  height:9px;
  border:solid #ffffff;
  border-width:0 2px 2px 0;
  transform:rotate(45deg);
}

.template_row_title{
  min-width:0;
  color:#111827;
  font-size:13px;
  line-height:1.35;
  font-weight:760;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.template_row_meta{
  margin-top:4px;
  color:#6b7280;
  font-size:12px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.template_source_badge{
  display:inline-flex;
  align-items:center;
  height:18px;
  padding:0 6px;
  margin-right:6px;
  border-radius:999px;
  background:#f3f4f6;
  color:#4b5563;
  font-size:11px;
  font-weight:760;
  line-height:18px;
  vertical-align:1px;
}

.template_source_badge.is-server{
  background:#ecfdf5;
  color:#047857;
}

.template_source_badge.is-local{
  background:#fff7ed;
  color:#c2410c;
}

.template_status{
  display:inline-flex;
  align-items:center;
  gap:7px;
  color:#6b7280;
  font-size:12px;
  font-weight:700;
}

.template_status::before{
  content:"";
  width:8px;
  height:8px;
  border-radius:999px;
  background:#9ca3af;
}

.template_status.is-enabled{
  color:#2563eb;
}

.template_status.is-enabled::before{
  background:#2563eb;
}

.template_status.is-pending{
  color:#7c3aed;
}

.template_status.is-pending::before{
  background:#7c3aed;
}

.template_status.is-completed::before{
  background:#059669;
}

.template_status.is-disabled::before{
  background:#6b7280;
}

.template_status.is-archived{
  color:#475569;
}

.template_status.is-archived::before{
  background:#475569;
}

.template_version{
  color:#6b7280;
  font-size:12px;
}

.template_empty{
  margin:14px;
  min-height:160px;
  border:1px dashed #d1d5db;
  border-radius:8px;
  display:flex;
  align-items:center;
  justify-content:center;
  color:#6b7280;
  font-size:13px;
}

.template_empty[hidden]{
  display:none;
}

.template_preview_card{
  flex:0 0 86px;
  margin:14px 14px 10px;
  border:1px solid #e5e7eb;
  border-radius:8px;
  background:#f9fafb;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:8px;
  color:#374151;
  font-size:14px;
  font-weight:760;
}

.template_preview_card span{
  color:#9ca3af;
  font-size:12px;
  font-weight:400;
}

.template_detail_body{
  flex:1;
  min-height:0;
  padding:0 14px 14px;
  overflow:auto;
}

.template_detail_title{
  color:#111827;
  font-size:15px;
  line-height:1.35;
  font-weight:760;
  margin-bottom:4px;
}

.template_detail_code{
  color:#6b7280;
  font-size:12px;
  margin-bottom:12px;
}

.template_detail_tabs{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:6px;
  margin:12px 0;
  padding:4px;
  border:1px solid #e5e7eb;
  border-radius:8px;
  background:#f8fafc;
}

.template_detail_tabs button{
  height:32px;
  border:1px solid transparent;
  border-radius:6px;
  background:transparent;
  color:#64748b;
  font-size:13px;
  font-weight:780;
  cursor:pointer;
}

.template_detail_tabs button.is-active{
  border-color:#bfdbfe;
  background:#ffffff;
  color:#1d4ed8;
  box-shadow:0 1px 5px rgba(15,23,42,.06);
}

.template_detail_tab_body{
  display:grid;
  gap:8px;
}

.template_field_cards_tab{
  display:grid;
  gap:10px;
}

.template_field_cards_overview{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px;
  border:1px solid #dbeafe;
  border-radius:8px;
  background:#f8fbff;
}

.template_field_cards_overview strong{
  display:block;
  color:#111827;
  font-size:14px;
  line-height:1.35;
}

.template_field_cards_overview p{
  margin:3px 0 0;
  color:#64748b;
  font-size:12px;
  line-height:1.45;
}

.template_field_cards_overview button,
.template_field_cards_modal_head button{
  flex:0 0 auto;
  height:32px;
  padding:0 12px;
  border:1px solid #2563eb;
  border-radius:6px;
  background:#2563eb;
  color:#ffffff;
  font-size:12px;
  font-weight:800;
  cursor:pointer;
}

.template_field_cards_stats,
.template_field_cards_section_preview{
  display:flex;
  flex-wrap:wrap;
  gap:7px;
}

.template_field_cards_stats span,
.template_field_cards_section_preview span{
  padding:5px 9px;
  border-radius:999px;
  background:#eef4ff;
  color:#1d4ed8;
  font-size:12px;
  font-weight:800;
}

.template_field_cards_section_preview span{
  border:1px dashed #d6e1ef;
  background:#ffffff;
  color:#475569;
}

.template_field_cards_section_preview b{
  margin-left:4px;
  color:#1d4ed8;
}

.template_field_cards_modal{
  position:fixed;
  inset:0;
  z-index:1200;
  display:block;
  padding:0;
}

.template_field_cards_modal_backdrop{
  position:absolute;
  inset:0;
  background:rgba(15,23,42,.38);
}

.template_field_cards_modal_panel{
  position:fixed;
  top:48px;
  left:50%;
  transform:translateX(-50%);
  z-index:1;
  display:grid;
  grid-template-rows:auto minmax(0, 1fr);
  width:min(1120px, calc(100vw - 64px));
  height:min(760px, calc(100vh - 96px));
  min-height:0;
  border:1px solid #d8e2ef;
  border-radius:10px;
  background:#ffffff;
  box-shadow:0 24px 70px rgba(15,23,42,.24);
  overflow:hidden;
}

.template_field_cards_modal_head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:14px 16px;
  border-bottom:1px solid #e5edf7;
  background:#f8fafc;
}

.template_field_cards_modal_head > div:first-child{
  min-width:0;
}

.template_field_cards_modal_head strong{
  display:block;
  color:#111827;
  font-size:16px;
  line-height:1.35;
}

.template_field_cards_modal_head span{
  display:block;
  margin-top:3px;
  color:#64748b;
  font-size:12px;
  font-weight:700;
}

.template_field_cards_modal_actions{
  display:flex;
  align-items:center;
  gap:8px;
  flex:0 0 auto;
}

.template_field_cards_modal_actions button{
  border-color:#cbd5e1;
  background:#ffffff;
  color:#0f172a;
}

.template_field_cards_modal_actions button.is-primary{
  border-color:#2563eb;
  background:#2563eb;
  color:#ffffff;
}

.template_field_cards_modal_body{
  min-height:0;
  height:100%;
  padding:14px;
  overflow:auto;
}

.template_field_cards_modal_body .tfcm_body{
  align-items:start;
  grid-template-columns:220px minmax(0, 1fr);
}

.template_field_cards_modal_body .tfcm_nav{
  position:sticky;
  top:0;
  align-self:start;
}

.template_field_cards_modal_body .tfcm_grid{
  grid-template-columns:repeat(3, minmax(0, 1fr));
}

.template_field_card_detail_overlay{
  position:absolute;
  inset:0;
  z-index:5;
  display:grid;
  place-items:start center;
  padding:72px 18px 18px;
  pointer-events:none;
}

.template_field_card_detail_backdrop{
  position:absolute;
  inset:0;
  background:rgba(15,23,42,.18);
  pointer-events:auto;
}

.template_field_card_detail_panel{
  position:relative;
  z-index:1;
  width:min(520px, 100%);
  max-height:min(520px, calc(100vh - 180px));
  overflow:hidden;
  border:1px solid #d8e2ef;
  border-radius:10px;
  background:#ffffff;
  box-shadow:0 18px 44px rgba(15,23,42,.22);
  pointer-events:auto;
}

.template_field_card_detail_head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  padding:14px 16px 12px;
  border-bottom:1px solid #e5edf7;
}

.template_field_card_detail_head span{
  display:block;
  color:#b91c1c;
  font-size:12px;
  font-weight:800;
  line-height:1.2;
}

.template_field_card_detail_head strong{
  display:block;
  margin-top:4px;
  color:#0f172a;
  font-size:18px;
  line-height:1.35;
}

.template_field_card_detail_head button{
  display:inline-grid;
  place-items:center;
  inline-size:28px;
  block-size:28px;
  border:0;
  border-radius:6px;
  padding:0;
  background:transparent;
  color:#0f172a;
  cursor:pointer;
}

.template_field_card_detail_head button:hover{
  background:#f1f5f9;
}

.template_field_card_detail_head svg{
  inline-size:18px;
  block-size:18px;
}

.template_field_card_detail_head path{
  fill:none;
  stroke:currentColor;
  stroke-width:2;
  stroke-linecap:round;
}

.template_field_card_detail_body{
  display:grid;
  gap:8px;
  max-height:420px;
  padding:12px 16px 16px;
  overflow:auto;
}

.template_field_card_detail_row{
  display:grid;
  grid-template-columns:92px minmax(0, 1fr);
  gap:12px;
  align-items:center;
  min-height:34px;
  padding:8px 10px;
  border:1px solid #dbe5f1;
  border-radius:7px;
  background:#f8fafc;
}

.template_field_card_detail_row span{
  color:#64748b;
  font-size:12px;
  font-weight:800;
}

.template_field_card_detail_row strong{
  min-width:0;
  overflow:hidden;
  color:#0f172a;
  font-size:13px;
  font-weight:800;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.template_field_cards_empty{
  display:grid;
  gap:8px;
  padding:14px;
  border:1px dashed #cbd5e1;
  border-radius:8px;
  background:#f8fafc;
  color:#64748b;
  font-size:13px;
  line-height:1.5;
}

.template_field_cards_empty strong{
  color:#111827;
  font-size:14px;
}

.template_field_cards_empty button{
  justify-self:start;
  height:30px;
  padding:0 10px;
  border:1px solid #bfdbfe;
  border-radius:6px;
  background:#ffffff;
  color:#1d4ed8;
  font-size:12px;
  font-weight:800;
  cursor:pointer;
}

.detail_kv{
  display:grid;
  grid-template-columns:54px minmax(0, 1fr);
  gap:10px;
  padding:7px 0;
  font-size:12px;
  line-height:1.4;
}

.detail_kv span:first-child{
  color:#6b7280;
}

.detail_kv span:last-child{
  color:#111827;
  font-weight:700;
}

.template_fill_rules_tab{
  display:grid;
  gap:12px;
  padding:12px;
  border:1px solid #dbeafe;
  border-radius:8px;
  background:#f8fbff;
}

.template_fill_rules_tab_head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}

.template_fill_rules_tab_head strong{
  display:block;
  color:#b91c1c;
  font-size:14px;
  font-weight:840;
}

.template_fill_rules_tab_head p{
  margin:5px 0 0;
  color:#475569;
  font-size:12px;
  line-height:1.45;
}

.template_fill_rules_tab_actions{
  flex:0 0 auto;
  display:flex;
  gap:8px;
}

.template_fill_rules_tab_actions button,
.template_fill_rules_tab_head > button{
  height:32px;
  padding:0 12px;
  border:1px solid #bfdbfe;
  border-radius:6px;
  background:#ffffff;
  color:#1d4ed8;
  font-size:12px;
  font-weight:780;
  cursor:pointer;
}

.template_fill_rules_tab_actions button.is-primary{
  border-color:#2563eb;
  background:#2563eb;
  color:#ffffff;
}

.template_fill_rules_module_preview{
  display:grid;
  gap:8px;
}

.template_fill_rules_module_card{
  display:grid;
  grid-template-columns:minmax(0, 1fr) auto;
  gap:10px;
  align-items:center;
  padding:10px 12px;
  border:1px solid #dbeafe;
  border-radius:8px;
  background:#ffffff;
}

.template_fill_rules_module_card div{
  min-width:0;
  display:grid;
  gap:4px;
}

.template_fill_rules_module_card strong{
  min-width:0;
  overflow:hidden;
  color:#111827;
  font-size:13px;
  font-weight:820;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.template_fill_rules_module_card span{
  color:#64748b;
  font-size:12px;
  font-weight:700;
}

.template_fill_rules_module_card em{
  color:#166534;
  font-size:13px;
  font-style:normal;
  font-weight:840;
}

.template_fill_rules_empty{
  padding:14px;
  border:1px dashed #bfdbfe;
  border-radius:8px;
  background:#ffffff;
  color:#64748b;
  font-size:12px;
  line-height:1.55;
}

.template_fill_rules_dialog{
  width:min(1040px, calc(100vw - 48px));
  max-height:calc(100vh - 48px);
  display:flex;
  flex-direction:column;
  border:1px solid #dbe3ef;
  border-radius:10px;
  background:#ffffff;
  box-shadow:0 24px 70px rgba(15, 23, 42, .24);
  overflow:hidden;
}

.template_fill_rules_dialog header{
  flex:0 0 auto;
  min-height:68px;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  padding:18px 20px 14px;
  border-bottom:1px solid #e5e7eb;
  background:#f8fafc;
}

.template_fill_rules_dialog h2{
  margin:0;
  color:#111827;
  font-size:18px;
  font-weight:820;
}

.template_fill_rules_dialog p{
  margin:6px 0 0;
  color:#64748b;
  font-size:13px;
  line-height:1.45;
}

.template_fill_rules_dialog_body{
  flex:1 1 auto;
  min-height:0;
  overflow:auto;
  padding:14px 18px;
  background:#f8fafc;
}

.template_fill_rules_dialog_empty{
  min-height:220px;
  display:flex;
  align-items:center;
  justify-content:center;
  border:1px dashed #cbd5e1;
  border-radius:8px;
  background:#ffffff;
  color:#64748b;
  font-size:14px;
  font-weight:700;
}

.template_fill_rules_module{
  border:1px solid #dbeafe;
  border-radius:8px;
  background:#ffffff;
  overflow:hidden;
}

.template_fill_rules_module + .template_fill_rules_module{
  margin-top:12px;
}

.template_fill_rules_module > header{
  min-height:44px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:10px 12px;
  border-bottom:1px solid #e5e7eb;
  background:#eff6ff;
}

.template_fill_rules_module > header strong{
  color:#1e3a8a;
  font-size:14px;
  font-weight:820;
}

.template_fill_rules_module > header span{
  color:#475569;
  font-size:12px;
  font-weight:760;
}

.template_fill_rules_editor_rows{
  display:grid;
  gap:10px;
  padding:12px;
}

.template_fill_rules_module_list{
  display:grid;
  gap:12px;
}

.template_fill_rules_editor_row{
  display:grid;
  grid-template-columns:minmax(0, 1fr) 330px;
  gap:12px;
  padding:12px;
  border:1px solid #e5e7eb;
  border-radius:8px;
  background:#ffffff;
}

.template_fill_rules_editor_row.is-module{
  border-color:#dbeafe;
  box-shadow:0 8px 22px rgba(15, 23, 42, .05);
}

.template_fill_rules_editor_main,
.template_fill_rules_editor_controls{
  display:grid;
  gap:10px;
  min-width:0;
}

.template_fill_rules_editor_controls{
  grid-template-columns:repeat(auto-fit, minmax(150px, 1fr));
  align-items:end;
}

.template_fill_rules_editor_row label{
  min-width:0;
  display:grid;
  gap:5px;
  color:#64748b;
  font-size:12px;
  font-weight:760;
}

.template_fill_rules_editor_row input[type="text"],
.template_fill_rules_editor_row select{
  width:100%;
  min-width:0;
  height:34px;
  border:1px solid #cbd5e1;
  border-radius:7px;
  background:#ffffff;
  color:#111827;
  font-size:13px;
  font-weight:650;
  padding:0 10px;
  box-sizing:border-box;
}

.template_fill_rules_enabled{
  grid-column:1 / -1;
  grid-template-columns:auto 1fr;
  align-items:center;
}

.template_fill_rules_enabled input{
  width:16px;
  height:16px;
}

.template_fill_rules_editor_row footer{
  grid-column:1 / -1;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding-top:2px;
}

.template_fill_rules_editor_row code{
  min-width:0;
  overflow:hidden;
  color:#64748b;
  font-size:11px;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.template_fill_rules_editor_row footer em{
  flex:0 0 auto;
  color:#166534;
  font-size:12px;
  font-style:normal;
  font-weight:800;
}

.template_detail_actions{
  display:none;
}

.template_detail_actions .is-primary{
  grid-column:1 / -1;
}

.template_detail_note{
  padding:12px 14px 14px;
}

.template_center_dockbar{
  flex:0 0 auto;
  min-height:76px;
  display:flex;
  align-items:center;
  gap:14px;
  border-top:1px solid #e5e7eb;
  background:#ffffff;
  padding:8px 12px 10px;
  margin:0 -18px;
  box-shadow:0 -8px 24px rgba(17,24,39,0.04);
}

.template_center_dockbar[hidden]{
  display:none;
}

/* 模版中心统一使用全局 dockbar，页面内不再渲染第二套操作栏。 */
.template_center_dockbar[data-role="template_center_local_actions"]{
  display:none !important;
}

.dockbar_hint{
  width:210px;
  min-width:180px;
  color:#6b7280;
  font-size:12px;
  line-height:1.45;
}

.template_action_groups{
  flex:1;
  min-width:0;
  display:flex;
  align-items:center;
  gap:10px;
  overflow-x:auto;
  padding-bottom:2px;
}

.template_action_group{
  flex:0 0 auto;
  display:flex;
  align-items:center;
  gap:5px;
  min-height:56px;
  padding:0 10px;
  border-right:1px solid #eef0f3;
}

.template_action_group[hidden],
.dockbar_icon_btn[hidden]{
  display:none;
}

.template_action_group:last-child{
  border-right:0;
}

.template_action_group > span{
  color:#9ca3af;
  font-size:11px;
  font-weight:760;
  margin-right:3px;
}

.dockbar_icon_btn{
  width:46px;
  height:50px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:4px;
  border:1px solid transparent;
  border-radius:7px;
  background:#ffffff;
  color:#374151;
  cursor:pointer;
}

.dockbar_icon_btn:hover{
  border-color:#dbeafe;
  background:#eff6ff;
  color:#1d4ed8;
}

.dockbar_icon_btn.is-active{
  border-color:#2563eb;
  background:#eff6ff;
  color:#1d4ed8;
  box-shadow:inset 0 0 0 1px #2563eb;
}

.dockbar_icon_btn:disabled{
  opacity:.38;
  cursor:not-allowed;
  background:#ffffff;
  color:#9ca3af;
  border-color:transparent;
}

.dockbar_icon_btn svg{
  width:19px;
  height:19px;
  fill:none;
  stroke:currentColor;
  stroke-width:2;
  stroke-linecap:round;
  stroke-linejoin:round;
}

.dockbar_icon_btn b{
  color:inherit;
  font-size:11px;
  line-height:1;
  font-weight:760;
}

.dockbar_icon_btn.is-primary{
  color:#1d4ed8;
}

.dockbar_icon_btn.is-danger{
  color:#dc2626;
}

.template_settings_wrap{
  position:relative;
  flex:0 0 auto;
}

.template_settings_wrap[hidden]{
  display:none;
}

.template_settings_menu{
  position:fixed;
  right:auto;
  bottom:auto;
  z-index:1200;
  width:132px;
  padding:6px;
  border:1px solid #e5e7eb;
  border-radius:8px;
  background:#ffffff;
  box-shadow:0 14px 34px rgba(17,24,39,0.16);
}

.template_settings_menu[hidden]{
  display:none;
}

.template_settings_menu button{
  width:100%;
  height:34px;
  border:0;
  border-radius:6px;
  background:#ffffff;
  color:#111827;
  font-size:12px;
  font-weight:760;
  text-align:left;
  padding:0 10px;
  cursor:pointer;
}

.template_settings_menu button:hover{
  background:#eff6ff;
  color:#1d4ed8;
}

.template_edit_card_library_dialog{
  width:min(880px, calc(100vw - 40px));
  max-height:min(640px, calc(100vh - 40px));
  border:1px solid #e5e7eb;
  border-radius:10px;
  background:#ffffff;
  box-shadow:0 24px 70px rgba(17,24,39,0.24);
  display:flex;
  flex-direction:column;
  overflow:hidden;
}

.template_edit_card_library_dialog header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:18px 20px;
  border-bottom:1px solid #e5e7eb;
}

.template_edit_card_library_dialog h2{
  margin:0;
  color:#111827;
  font-size:18px;
  line-height:1.2;
}

.template_edit_card_library_dialog p{
  margin:6px 0 0;
  color:#6b7280;
  font-size:12px;
}

.template_edit_card_library_body{
  min-height:320px;
  padding:20px;
  background:#f9fafb;
  overflow:auto;
}

.template_edit_card_library_toolbar{
  display:grid;
  grid-template-columns:minmax(220px, 1fr) 128px 138px auto;
  gap:10px;
  align-items:center;
  margin-bottom:12px;
}

.template_edit_card_library_toolbar input,
.template_edit_card_library_toolbar select{
  height:34px;
  border:1px solid #d1d5db;
  border-radius:7px;
  background:#ffffff;
  color:#111827;
  font-size:12px;
  padding:0 10px;
}

.template_edit_card_library_summary{
  margin-bottom:12px;
  color:#6b7280;
  font-size:12px;
}

.template_edit_card_library_layout{
  display:grid;
  grid-template-columns:minmax(260px, 340px) minmax(0, 1fr);
  gap:14px;
  min-height:360px;
}

.template_edit_card_library_list,
.template_edit_card_library_detail{
  min-height:360px;
  border:1px solid #e5e7eb;
  border-radius:8px;
  background:#ffffff;
  overflow:auto;
}

.template_edit_card_library_list{
  padding:8px;
}

.template_edit_card_library_item{
  width:100%;
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:5px;
  border:1px solid transparent;
  border-radius:7px;
  background:#ffffff;
  color:#111827;
  padding:10px;
  text-align:left;
  cursor:pointer;
}

.template_edit_card_library_item:hover,
.template_edit_card_library_item.is-active{
  border-color:#bfdbfe;
  background:#eff6ff;
}

.template_edit_card_library_item_name{
  font-size:13px;
  font-weight:760;
}

.template_edit_card_library_item_path{
  color:#2563eb;
  font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size:11px;
  word-break:break-all;
}

.template_edit_card_library_item_meta,
.template_edit_card_library_chips{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
}

.template_edit_card_library_item_meta b,
.template_edit_card_library_chips span{
  border-radius:999px;
  background:#f1f5f9;
  color:#475569;
  font-size:11px;
  font-weight:700;
  line-height:1;
  padding:5px 7px;
}

.template_edit_card_library_detail{
  padding:16px;
}

.template_edit_card_library_info{
  border-bottom:1px solid #e5e7eb;
  padding-bottom:14px;
  margin-bottom:14px;
}

.template_edit_card_library_form{
  border-bottom:1px solid #e5e7eb;
  padding-bottom:14px;
  margin-bottom:14px;
}

.template_edit_card_library_info h3,
.template_edit_card_library_form h3,
.template_edit_card_library_refs h3{
  margin:0 0 8px;
  color:#111827;
  font-size:14px;
}

.template_edit_card_library_info code{
  display:block;
  margin-bottom:10px;
  color:#1d4ed8;
  font-size:12px;
  word-break:break-all;
}

.template_edit_card_library_info p{
  margin:10px 0 0;
  color:#4b5563;
  font-size:12px;
  line-height:1.6;
}

.template_edit_card_library_form label{
  display:flex;
  flex-direction:column;
  gap:5px;
  margin-bottom:10px;
}

.template_edit_card_library_form span{
  color:#6b7280;
  font-size:11px;
  font-weight:760;
}

.template_edit_card_library_form input,
.template_edit_card_library_form select,
.template_edit_card_library_form textarea{
  width:100%;
  border:1px solid #d1d5db;
  border-radius:7px;
  background:#ffffff;
  color:#111827;
  font-size:12px;
  padding:8px 9px;
}

.template_edit_card_library_form textarea{
  min-height:72px;
  resize:vertical;
}

.template_edit_card_library_form_grid{
  display:grid;
  grid-template-columns:1fr 132px 112px;
  gap:10px;
}

.template_edit_card_library_ref{
  display:flex;
  flex-direction:column;
  gap:4px;
  border:1px solid #e5e7eb;
  border-radius:7px;
  padding:10px;
  margin-bottom:8px;
}

.template_edit_card_library_ref strong{
  color:#111827;
  font-size:12px;
}

.template_edit_card_library_ref span{
  color:#374151;
  font-size:12px;
}

.template_edit_card_library_ref small,
.template_edit_card_library_ref_empty{
  color:#6b7280;
  font-size:11px;
}

.template_edit_card_library_empty{
  height:100%;
  min-height:280px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:8px;
  border:1px dashed #cbd5e1;
  border-radius:8px;
  background:#ffffff;
  color:#64748b;
  text-align:center;
}

.template_edit_card_library_empty strong{
  color:#111827;
  font-size:15px;
}

.template_edit_card_library_empty span{
  max-width:420px;
  font-size:12px;
  line-height:1.6;
}

.template_modal_backdrop{
  position:absolute;
  inset:0;
  z-index:5;
  background:rgba(17,24,39,0.42);
  display:flex;
  align-items:center;
  justify-content:center;
}

.template_modal_backdrop[hidden]{
  display:none;
}

.template_modal_backdrop[data-role="pending_review_dialog"]{
  position:fixed;
  inset:0;
  z-index:80;
  align-items:center;
  justify-content:center;
  padding:24px;
  background:rgba(17,24,39,0.48);
}

.template_category_dialog,
.template_pending_review_dialog,
.template_info_dialog{
  width:380px;
  border:1px solid #e5e7eb;
  border-radius:10px;
  background:#ffffff;
  padding:22px 24px;
  box-shadow:0 24px 70px rgba(17,24,39,0.24);
}

.template_pending_review_dialog{
  width:min(520px, calc(100vw - 48px));
  padding:30px 34px;
  border-radius:12px;
  box-shadow:0 28px 90px rgba(15,23,42,0.28);
}

.template_pending_review_dialog h2{
  margin:0;
  color:#111827;
  font-size:26px;
  line-height:1.2;
  font-weight:800;
}

.template_pending_review_dialog p{
  margin:12px 0 0;
  color:#374151;
  font-size:16px;
  line-height:1.65;
}

.template_pending_review_dialog .dialog_actions{
  margin-top:28px;
}

.template_pending_review_dialog .template_center_btn{
  min-width:88px;
  height:44px;
  font-size:14px;
}

.template_info_dialog{
  width:min(520px, calc(100vw - 48px));
  padding:0;
  overflow:hidden;
}

.template_info_dialog header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  padding:18px 20px 14px;
  border-bottom:1px solid #eef0f3;
}

.template_info_dialog h2{
  margin:0;
  color:#111827;
  font-size:18px;
  line-height:1.3;
  font-weight:800;
}

.template_info_dialog p{
  margin:6px 0 0;
  color:#64748b;
  font-size:12px;
  line-height:1.4;
}

.template_info_form{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px;
  padding:18px 20px 6px;
}

.template_info_form label:first-child,
.template_info_form label:nth-child(5){
  grid-column:1 / -1;
}

.template_info_form label{
  display:flex;
  flex-direction:column;
  gap:7px;
  min-width:0;
  color:#374151;
  font-size:12px;
  font-weight:760;
}

.template_info_form input,
.template_info_form select{
  width:100%;
  height:36px;
  border:1px solid #cfd6df;
  border-radius:8px;
  background:#ffffff;
  padding:0 10px;
  color:#111827;
  font:inherit;
  outline:none;
}

.template_info_form input:focus,
.template_info_form select:focus{
  border-color:#2563eb;
  box-shadow:0 0 0 3px rgba(37,99,235,0.12);
}

.template_info_dialog .dialog_actions{
  padding:16px 20px 20px;
  margin-top:0;
}

.template_style_dialog{
  display:flex;
  flex-direction:column;
  width:min(980px, calc(100vw - 44px));
  height:min(760px, calc(100vh - 54px));
  overflow:hidden;
  border:1px solid #e5e7eb;
  border-radius:10px;
  background:#ffffff;
  box-shadow:0 24px 70px rgba(17,24,39,0.24);
}

.template_style_dialog header{
  position:sticky;
  top:0;
  z-index:2;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  padding:20px 22px 14px;
  border-bottom:1px solid #eef0f3;
  background:#ffffff;
}

.template_style_header_actions{
  display:flex;
  flex:0 0 auto;
  gap:8px;
  margin-left:auto;
}

.template_style_icon_btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:34px;
  height:34px;
  border:1px solid #d1d5db;
  border-radius:8px;
  background:#ffffff;
  color:#374151;
  cursor:pointer;
}

.template_style_icon_btn:hover{
  border-color:#9ca3af;
  background:#f9fafb;
}

.template_style_icon_btn.is-primary{
  border-color:#2563eb;
  background:#2563eb;
  color:#ffffff;
}

.template_style_icon_btn.is-primary:hover{
  border-color:#1d4ed8;
  background:#1d4ed8;
}

.template_style_icon_btn svg{
  width:18px;
  height:18px;
  fill:none;
  stroke:currentColor;
  stroke-width:2;
  stroke-linecap:round;
  stroke-linejoin:round;
}

.template_category_dialog h2{
  font-size:18px;
  line-height:1.3;
}

.template_style_dialog h2{
  font-size:18px;
  line-height:1.3;
}

.template_style_dialog p{
  margin-top:6px;
  color:#6b7280;
  font-size:12px;
  line-height:1.5;
}

.template_category_dialog label{
  display:flex;
  flex-direction:column;
  gap:8px;
  margin-top:20px;
  color:#374151;
  font-size:12px;
  font-weight:760;
}

.template_style_grid{
  display:grid;
  grid-template-columns:220px minmax(0, 1fr);
  flex:1 1 auto;
  gap:14px;
  min-height:0;
  overflow:hidden;
  padding:18px 22px 20px;
  margin-top:0;
}

.template_style_mode_list{
  display:flex;
  flex-direction:column;
  gap:10px;
  min-width:0;
}

.template_style_mode_item{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:6px;
  width:100%;
  border:1px solid #e5e7eb;
  border-radius:10px;
  background:#ffffff;
  padding:13px 14px;
  color:#111827;
  text-align:left;
  cursor:pointer;
}

.template_style_mode_item:hover{
  border-color:#bfdbfe;
  background:#f8fafc;
}

.template_style_mode_item.is-active{
  border-color:#2563eb;
  background:#eff6ff;
  box-shadow:0 0 0 1px rgba(37,99,235,0.16);
}

.template_style_mode_item strong{
  font-size:13px;
  font-weight:850;
}

.template_style_mode_item span{
  color:#64748b;
  font-size:12px;
  line-height:1.4;
}

.template_style_mode_detail{
  min-width:0;
  min-height:0;
  overflow:hidden;
}

.template_style_panel{
  display:flex;
  flex-direction:column;
  gap:10px;
  min-width:0;
  height:100%;
  overflow:auto;
}

.template_style_panel[hidden]{
  display:none;
}

.template_style_static_panel{
  border:1px solid #e5e7eb;
  border-radius:10px;
  background:#ffffff;
  padding:16px;
}

.template_style_static_head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:14px;
}

.template_style_static_head strong{
  color:#111827;
  font-size:14px;
  font-weight:850;
}

.template_style_static_head span{
  color:#64748b;
  font-size:12px;
}

.template_style_static_grid{
  display:grid;
  grid-template-columns:90px minmax(0, 1fr);
  align-items:start;
  gap:10px 14px;
}

.template_style_static_grid > span{
  color:#64748b;
  font-size:12px;
  font-weight:760;
}

.template_style_static_grid > strong{
  color:#111827;
  font-size:13px;
  font-weight:760;
  line-height:1.5;
}

.template_style_grid_head,
.template_style_row{
  display:grid;
  grid-template-columns:104px minmax(128px, 1fr) 82px 92px 82px 70px 76px;
  align-items:center;
  gap:8px;
}

.template_style_semantic_rows{
  display:flex;
  flex-direction:column;
  gap:10px;
  min-width:0;
}

.template_style_grid_head{
  color:#6b7280;
  font-size:11px;
  font-weight:760;
  padding:0 2px;
}

.template_style_row{
  padding:8px 10px;
  border:1px solid #eef0f3;
  border-radius:8px;
  background:#f9fafb;
}

.template_style_row > span{
  color:#111827;
  font-size:12px;
  font-weight:800;
}

.template_category_dialog input{
  height:42px;
  border:1px solid #d1d5db;
  border-radius:8px;
  padding:0 12px;
  outline:0;
  color:#111827;
  font:inherit;
  font-size:13px;
}

.template_style_row input,
.template_style_row select{
  width:100%;
  height:32px;
  min-width:0;
  border:1px solid #d1d5db;
  border-radius:7px;
  background:#ffffff;
  padding:0 9px;
  outline:0;
  color:#111827;
  font:inherit;
  font-size:12px;
}

.dialog_actions{
  display:flex;
  justify-content:flex-end;
  gap:12px;
  margin-top:24px;
}

@media (max-width: 1180px){
  .template_center_shell{
    overflow:hidden;
  }

  .template_center_main{
    min-height:0;
    grid-template-columns:160px minmax(390px, 1fr) minmax(300px, .78fr);
  }

  .template_center_detail_panel{
    grid-column:auto;
  }
}

@media (max-width: 940px){
  .template_center_shell{
    overflow:auto;
  }

  .template_center_main{
    min-height:760px;
    grid-template-columns:180px minmax(360px, 1fr);
  }

  .template_center_detail_panel{
    grid-column:1 / -1;
  }
}

@media (max-width: 760px){
  .template_center_shell{
    padding:16px 12px 86px;
  }

  .template_center_main{
    display:flex;
    flex-direction:column;
    overflow:visible;
  }
}
