.tl-page { display: grid; gap: 15px; }
.tl-page > .page-header { margin-bottom: 4px; }
.tl-actions, .tl-table-tools, .tl-tabs, .tl-field-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tl-actions { flex-wrap: wrap; }
.tl-template-table { overflow: hidden; }
.tl-table-toolbar, .tl-selection, .tl-info-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
}
.tl-table-toolbar { flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.tl-tabs { gap: 4px; }
.tl-tab {
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 620;
  white-space: nowrap;
}
.tl-tab:hover { background: #f3f6f9; }
.tl-tab.is-active { background: var(--accent-soft); color: var(--accent-strong); }
.tl-table-tools { flex-wrap: wrap; }
.tl-search, .tl-sort { position: relative; display: flex; align-items: center; }
.tl-search > .icon, .tl-sort > .icon { position: absolute; left: 9px; color: var(--muted); pointer-events: none; }
.tl-search input, .tl-sort select { padding-left: 32px !important; }
.tl-search input { width: min(210px, 52vw); }
.tl-sort select { min-width: 188px; }
.tl-selection {
  min-height: 51px;
  background: #f5fbff;
  border-bottom: 1px solid #e6f2fc;
  color:var(--accent-strong);
  font-size: 13px;
}
.tl-selection .btn { min-height: 28px; padding: 4px 8px; }
.tl-table { min-width: 590px; }
.tl-table .tl-check-cell { width: 48px; padding-right: 6px; }
.tl-template-name, .tl-designer-heading {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}
.tl-template-name { min-width: 218px; }
.tl-tile-icon, .tl-field-type-icon {
  display: grid;
  place-items: center;
  flex: none;
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-radius: 8px;
  width: 35px;
  height: 35px;
}
.tl-small { font-size: 11.5px; margin-top: 2px; }
.tl-mid-dot { margin: 0 2px; }
.tl-text-button {
  display: inline;
  border: 0;
  padding: 0;
  background: none;
  color: var(--text);
  font-weight: 660;
  text-align: left;
}
.tl-text-button:hover { color: var(--accent-strong); text-decoration: underline; }
.tl-layout-badge {
  display: inline-flex;
  border: 1px solid #e9edf1;
  border-radius: 99px;
  background: #f4f6f8;
  padding: 2px 8px;
  color: #5e586a;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.tl-description {
  color: var(--muted);
  min-width: 160px;
  max-width: 270px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tl-row-actions { width: 55px; text-align: right; }
.tl-row-actions .btn { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.tl-table-footer {
  padding: 10px 15px;
  border-top: 1px solid var(--border);
  font-size: 12px;
}
.tl-info-card { justify-content: flex-start; }
.tl-info-card > div { flex: 1; }
.tl-info-card strong { font-weight: 650; }
.tl-info-card p { margin-top: 2px; font-size: 12.5px; }
.tl-empty { display: grid; place-items: center; gap: 8px; padding: 33px 16px; color: var(--muted); text-align: center; }
.tl-empty > .icon { color: var(--accent-strong); }
.tl-empty strong { color: var(--text); font-size: 15px; }
.tl-empty .btn { margin-top: 4px; }
.tl-designer-heading > .icon-btn { flex: none; }
.tl-designer-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(295px, 1fr);
  align-items: start;
  gap: 15px;
}
.tl-designer-form { display: grid; gap: 15px; min-width: 0; }
.tl-designer-aside { position: sticky; top: calc(var(--header-height) + 15px); min-width: 0; }
.tl-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 17px;
  border-bottom: 1px solid var(--border);
}
.tl-card-header h2 { font-size: 16px; }
.tl-card-header p { margin-top: 4px; font-size: 12.5px; }
.tl-card-content { padding: 15px 17px; }
.tl-stack, .tl-grid { display: grid; gap: 12px; }
.tl-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tl-field { display: grid; align-content: start; gap: 5px; min-width: 0; }
.tl-field > span:first-child { font-size: 13px; font-weight: 600; }
.tl-field input:not([type="checkbox"]), .tl-field select { width: 100%; }
.tl-number { position: relative; display: flex; align-items: center; }
.tl-number:has(> span) > input { padding-right: 34px; }
.tl-number > span {
  position: absolute;
  right: 9px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 550;
  pointer-events: none;
}
.tl-number input::-webkit-inner-spin-button { appearance: none; }
.tl-number input[type="number"] { appearance: textfield; }
.tl-details {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfcfd;
}
.tl-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 10px;
  list-style: none;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 620;
}
.tl-details > summary::-webkit-details-marker { display: none; }
.tl-details[open] > summary > .icon { transform: rotate(180deg); }
.tl-details > .tl-grid { padding: 5px 10px 10px; }
.tl-field-list { display: grid; gap: 7px; }
.tl-field-row {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: white;
}
.tl-field-row.is-active { border-color: #cae4fa; }
.tl-field-row.is-active .tl-field-row-top { background: #f7fbff; }
.tl-field-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-height: 40px;
  padding: 4px 6px;
}
.tl-field-select {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  padding: 2px 4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 620;
  text-align: left;
}
.tl-field-select:hover { color: var(--accent-strong); }
.tl-field-type-icon { width: 27px; height: 27px; border-radius: 6px; }
.tl-field-actions { gap: 2px; }
.tl-field-actions .btn {
  width: 25px;
  min-height: 25px;
  padding: 2px;
  gap: 0;
  border-color: transparent;
  box-shadow: none;
  background: transparent;
  color: var(--muted);
}
.tl-field-actions .btn span:empty { display: none; }
.tl-field-actions .btn:hover:not(:disabled) { background: #ebf0f5; border-color: transparent; }
.tl-field-editor {
  display: grid;
  gap: 10px;
  border-top: 1px solid #e6f2fb;
  padding: 11px;
}
.tl-field-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 13px; }
.tl-control-label { display: block; margin-bottom: 5px; font-size: 12px; font-weight: 620; }
.tl-segment {
  display: inline-flex;
  gap: 2px;
  align-items: center;
  border: 1px solid var(--border);
  background: #f6f8f9;
  border-radius: 8px;
  padding: 3px;
}
.tl-segment button {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  min-height: 26px;
  padding: 3px 7px;
  border: 1px solid transparent;
  border-radius: 5px;
  color: #615a6c;
  background: transparent;
  font-size: 12px;
  font-weight: 640;
  white-space: nowrap;
}
.tl-segment button[aria-pressed="true"] {
  color: var(--accent-strong);
  background: white;
  border-color: #e2ebf3;
  box-shadow: 0 1px 1px #12223015;
}
.tl-check-label { display: inline-flex; align-items: center; gap: 7px; min-height: 33px; font-size: 12px; }
.tl-add-field { display: flex; align-items: center; gap: 8px; }
.tl-add-field > label { flex: 1; max-width: 215px; }
.tl-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  border: 0;
  clip-path: inset(50%);
  white-space: nowrap;
}
.tl-designer-error {
  border: 1px solid #f1c4ca;
  border-radius: 8px;
  background: #fff0f2;
  color: #8c1e32;
  padding: 9px 13px;
  font-size: 13px;
}
.tl-preview-toolbar { padding: 12px 15px 9px; }
.tl-preview-stage {
  display: grid;
  min-height: 248px;
  place-items: center;
  margin: 0 15px;
  border: 1px solid #e6edf2;
  border-radius: 9px;
  padding: 15px;
  background-color: #f4f8fb;
  background-image: radial-gradient(circle, #d3dfe8 1px, transparent 1.05px);
  background-size: 13px 13px;
  overflow: auto;
}
.tl-preview-paper {
  position: relative;
  flex: none;
  background: #fff;
  box-shadow: 0 3px 14px #17314721, 0 0 0 1px #232d3616;
}
.tl-physical-label {
  position: absolute;
  inset: 0 auto auto 0;
  transform-origin: top left;
}
.tl-physical-grid {
  display: grid;
  align-content: start;
  box-sizing: border-box;
  overflow: hidden;
  background: #fff;
}
.tl-physical-cell { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
.tl-physical-cell::after {
  content: "";
  position: absolute;
  inset: 0;
  border: .25mm dashed #c0cad2;
  pointer-events: none;
}
.tl-physical-cell.is-blank { background: #f8fafc; }
.tl-preview-caption {
  padding: 8px 15px 0;
  color: var(--muted);
  text-align: center;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.tl-no-preview { color: var(--muted); text-align: center; }
.tl-modal-preview { margin: 0; min-height: 272px; }
.tl-dialog-intro { margin: 0 0 12px; }
.tl-file-drop {
  position: relative;
  display: grid;
  place-items: center;
  gap: 5px;
  min-height: 132px;
  padding: 14px;
  text-align: center;
  border: 1px dashed #a8c7e1;
  border-radius: 10px;
  background: #fafdff;
  cursor: pointer;
}
.tl-file-drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.tl-file-drop strong { font-weight: 650; }
.tl-file-drop > input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.tl-file-drop .muted { font-size: 12px; }
.tl-message { margin-top: 9px; font-size: 12.5px; }
.tl-message:empty { display: none; }
.tl-message[data-tone="success"] { color: #226647; }
.tl-message[data-tone="error"] { color: #982435; }
.tl-option-list { display: grid; gap: 3px; }
.tl-option-list button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 7px;
  background: transparent;
  color: var(--text);
  border: 0;
  border-radius: 7px;
  text-align: left;
}
.tl-option-list button:hover { background: #f3f7fb; }
.tl-option-list button > .icon:last-child { margin-left: auto; color: var(--muted); }
.tl-option-list button[data-tl-option="delete"] { color: #9a2a3a; }
.tl-preset-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tl-preset-grid button {
  display: grid;
  justify-items: start;
  gap: 5px;
  padding: 11px;
  text-align: left;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
}
.tl-preset-grid button:hover { background: #f7fbff; border-color: #badefb; }
.tl-preset-grid button > .muted { font-size: 11.5px; }
@media (max-width: 1100px) {
  .tl-page-header .tl-actions { justify-content: flex-end; }
  .tl-info-card { align-items: flex-start; }
}
@media (max-width: 880px) {
  .tl-designer-layout { grid-template-columns: 1fr; }
  .tl-designer-aside { position: static; grid-row: 1; }
  .tl-preview-stage { min-height: 185px; }
}
@media (max-width: 700px) {
  .tl-page-header .tl-actions { justify-content: flex-start; }
  .tl-table-toolbar, .tl-selection { padding: 10px; }
  .tl-selection { align-items: flex-start; flex-wrap: wrap; }
  .tl-info-card { flex-wrap: wrap; }
  .tl-info-card > div { flex: 1 1 65%; }
  .tl-info-card > .btn { margin-left: 44px; }
}
.tl-preview-fit {
  margin: 10px 16px;
  padding: 8px 10px;
  color: #785305;
  background: #fff7df;
  border-radius: 8px;
  font-size: 12px;
}
