@font-face {
  font-family: "Inter";
  src: url("/cms/vendor/inter/InterVariable.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 100 900;
}

:root {
  --bg: #ffffff;
  --panel: #ffffff;
  --text: #111111;
  --muted: #555555;
  --line: #e8e8e8;
  --accent: #f57c00;
  --accent-hover: #de6f00;
  --danger: #d93025;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 14px;
  --shadow-soft: 0 4px 20px rgba(17, 17, 17, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", sans-serif;
  font-size: 12px;
  font-weight: 300;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
}

h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.25;
  letter-spacing: 0;
}

h1 {
  font-size: 1.24rem;
  font-weight: 300;
  margin-bottom: 6px;
}

h2 {
  font-size: 1.04rem;
  font-weight: 300;
  margin-bottom: 5px;
}

h3 {
  font-size: 0.86rem;
  font-weight: 300;
  margin-bottom: 4px;
}

h4 {
  font-size: 0.8rem;
  font-weight: 300;
  margin-bottom: 4px;
}

p {
  margin: 0 0 8px;
}

.layout {
  width: min(1180px, 94vw);
  margin: 10px auto 14px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 12px;
}

.hidden {
  display: none !important;
}

.panel-login {
  width: min(430px, 92vw);
  margin: 3vh auto;
}

label {
  display: block;
  font-size: 0.76rem;
  font-weight: 300;
  color: #222222;
  margin-bottom: 6px;
}

input,
select,
button,
textarea {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  margin-top: 4px;
  color: var(--text);
  background: #fff;
  font-size: 0.78rem;
  font-weight: 300;
}

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

input::placeholder,
textarea::placeholder {
  color: #9a9a9a;
  opacity: 1;
}

select[multiple] {
  min-height: 88px;
  padding: 4px 6px;
}

button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 31px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 6px 9px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 300;
  font-size: 0.78rem;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

button:hover,
.btn:hover {
  background: var(--accent-hover);
}

button:disabled,
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

button.danger,
.btn.danger {
  background: var(--danger);
}

button.danger:hover,
.btn.danger:hover {
  background: #be241a;
}

.muted {
  margin: 3px 0;
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 200;
  line-height: 1.35;
}

.error {
  color: var(--danger);
  font-size: 0.74rem;
  min-height: 16px;
}

.brand-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
}

.brand-header-logo {
  width: 178px;
  max-width: 45vw;
  height: auto;
}

.brand-header-copy {
  min-width: 0;
}

.brand-header-line {
  margin: 0;
  line-height: 1.22;
}

.brand-header-line-main {
  font-size: 0.8rem;
  font-weight: 200;
  color: #1f1f1f;
}

.brand-header-line-sub {
  margin-top: 2px;
  font-size: 0.72rem;
  font-weight: 100;
  color: #666666;
}

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

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

#app-title {
  font-size: 1rem;
  font-weight: 300;
  margin-bottom: 2px;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.topbar-actions button {
  min-height: 29px;
  padding: 5px 8px;
  font-size: 0.76rem;
}

.split {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 8px;
  margin-top: 8px;
}

/* A fixed height, not max-height: the grid row is as tall as its tallest column, so a
   list that shrinks while filtering would otherwise shrink the whole row and move the
   panel next to it. The stable gutter keeps the scrollbar's space reserved, so the
   search field doesn't widen when a short list stops needing one. */
.sidebar {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 8px;
  display: grid;
  align-content: start;
  gap: 10px;
  height: 74vh;
  overflow: auto;
  scrollbar-gutter: stable;
  background: #fff;
}

.stack-block {
  display: grid;
  gap: 7px;
}

.stack-block h3,
.preview h3 {
  margin: 0;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}

.inline-actions > input,
.inline-actions > select,
.inline-actions > textarea {
  margin-top: 0;
  flex: 1 1 180px;
}

.inline-actions > button {
  flex: 0 0 auto;
}

.row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.list {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: grid;
  gap: 5px;
}

.list li {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 6px 7px;
  display: grid;
  gap: 5px;
  background: #fff;
}

.list li > span {
  color: #1d1d1d;
  font-size: 0.75rem;
  font-weight: 300;
  line-height: 1.35;
}

.list.templates li.active {
  border-color: var(--accent);
  background: #fff8ef;
}

.list-item-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.list-item-actions button,
.list-item-actions .btn {
  min-height: 28px;
  padding: 4px 6px;
  font-size: 0.72rem;
}

.list-item-actions input,
.list-item-actions select {
  width: auto;
  min-width: 120px;
  min-height: 28px;
  margin-top: 0;
  padding: 4px 6px;
  font-size: 0.72rem;
}

.list-item-actions small {
  font-size: 0.69rem;
  color: var(--muted);
}

.templates-toolbar {
  position: sticky;
  top: -8px;
  z-index: 1;
  display: grid;
  gap: 7px;
  margin: -8px -8px 0;
  padding: 8px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.templates-toolbar h3 {
  margin: 0;
}

.templates-toolbar input[type="search"] {
  margin-top: 0;
}

/* the browser's own clear button (Chrome/Safari), restyled - clearing through it still
   fires the input event the list filter listens to */
.templates-toolbar input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  margin-left: 6px;
  border-radius: 50%;
  background: #ececec url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2.5 2.5l5 5M7.5 2.5l-5 5' stroke='%23555' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") center / 9px no-repeat;
  cursor: pointer;
}

.templates-toolbar input[type="search"]::-webkit-search-cancel-button:hover {
  background-color: #fff2de;
}

.filter-group {
  display: grid;
  gap: 4px;
}

.filter-label {
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.filter-chip {
  min-height: 24px;
  padding: 2px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-size: 0.72rem;
}

.filter-chip:hover {
  background: #fff8ef;
  border-color: var(--accent);
}

.filter-chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.filter-chip--tag[aria-pressed="true"] {
  background: #fff2de;
  color: #3a260b;
}

.list.templates {
  margin-top: 0;
}

.list.templates li.template-card {
  padding: 0;
}

.template-card-button {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  min-height: 0;
  padding: 7px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  text-align: left;
}

.template-card-button:hover {
  background: #fff8ef;
}

.template-thumb {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f4f2ee;
  color: #9a948a;
}

.template-thumb--image {
  background: #fff;
  border: 1px solid var(--line);
}

.template-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.template-card-body {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.template-card-title {
  font-size: 0.8rem;
  font-weight: 500;
  color: #1d1d1d;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-card-shortcut {
  font-size: 0.72rem;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-card-snippet {
  font-size: 0.7rem;
  font-weight: 300;
  color: var(--muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.templates-empty {
  display: grid;
  justify-items: start;
  gap: 4px;
}

.taxonomy-manage {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.taxonomy-manage > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 400;
  color: #2f2f2f;
  border-radius: 6px;
}

/* the native disclosure triangle, replaced by the app's chevron */
.taxonomy-manage > summary::-webkit-details-marker {
  display: none;
}

.taxonomy-manage > summary::before {
  content: "";
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  margin-left: 2px;
  border-right: 1.5px solid #666;
  border-bottom: 1.5px solid #666;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}

.taxonomy-manage[open] > summary::before {
  transform: rotate(45deg);
}

.taxonomy-manage > summary:hover {
  color: var(--accent);
}

.taxonomy-manage > summary:focus-visible {
  outline: 2px solid rgba(245, 124, 0, 0.35);
  outline-offset: 2px;
}

.taxonomy-manage[open] > summary {
  margin-bottom: 8px;
}

.taxonomy-manage > .stack-block + .stack-block {
  margin-top: 10px;
}

.editor {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 9px;
  overflow: auto;
  scrollbar-gutter: stable;
  max-height: 74vh;
  background: #fff;
}

.mvp-field-badge {
  display: inline-flex;
  align-items: center;
  background: #fff2de;
  color: #3a260b;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: help;
}

.mvp-field-badge--cursor,
.mvp-field-badge--formula {
  background: #ece7fb;
  color: #2c1f5c;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.aliases {
  margin-bottom: 8px;
}

.chips {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.chips li {
  background: #fff2de;
  color: #3a260b;
  border-radius: 999px;
  padding: 3px 9px;
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 300;
}

.chips button {
  background: transparent;
  color: #3a260b;
  padding: 0;
  min-height: 0;
  border: 0;
  font-size: 0.88rem;
}

#quill-editor {
  background: #fff;
  margin-top: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.ql-toolbar.ql-snow {
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 6px;
}

.ql-container.ql-snow {
  border: 0;
}

.ql-editor {
  min-height: 132px;
  padding: 8px 10px;
  font-size: 0.8rem;
  font-weight: 300;
  line-height: 1.45;
}

.editor-runtime-block {
  display: grid;
  gap: 6px;
}

.ql-snow.ql-toolbar button.toolbar-text-btn {
  width: auto;
  min-width: 28px;
  padding: 3px 5px;
  font-size: 15px;
  line-height: 18px;
  color: #444;
}

.ql-snow.ql-toolbar button.toolbar-text-btn:hover,
.ql-snow.ql-toolbar button.toolbar-text-btn[aria-expanded="true"] {
  color: #06c;
}

.app-popover {
  position: absolute;
  z-index: 50;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(17, 17, 17, 0.14);
}

.field-label {
  display: block;
  font-size: 0.76rem;
  font-weight: 300;
  color: #222222;
}

.field {
  margin-bottom: 6px;
}

button.app-select-trigger {
  width: 100%;
  min-height: 32px;
  margin-top: 4px;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-size: 0.78rem;
  text-align: left;
}

button.app-select-trigger:hover {
  background: #fff;
  border-color: #cfcfcf;
}

button.app-select-trigger:focus-visible,
button.app-select-trigger[aria-expanded="true"] {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(245, 124, 0, 0.15);
}

.app-select-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-select-chevron {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid #666;
  border-bottom: 1.5px solid #666;
  transform: translateY(-2px) rotate(45deg);
}

.app-select--multi {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  margin-top: 4px;
  padding: 3px 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}

.app-select-chips {
  display: contents;
}

.app-select-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 3px 2px 9px;
  border-radius: 999px;
  background: #fff2de;
  color: #3a260b;
  font-size: 0.72rem;
}

.app-select-chip button {
  min-height: 0;
  padding: 0 5px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #3a260b;
  font-size: 0.85rem;
  line-height: 1.2;
}

.app-select-chip button:hover {
  background: rgba(58, 38, 11, 0.1);
}

button.app-select-add {
  min-height: 24px;
  padding: 2px 9px;
  border: 1px dashed #d6d6d6;
  border-radius: 999px;
  background: transparent;
  color: var(--accent);
  font-size: 0.72rem;
}

button.app-select-add:hover,
button.app-select-add[aria-expanded="true"] {
  background: #fff8ef;
  border-color: var(--accent);
}

.app-select-list {
  max-height: 240px;
  overflow: auto;
  padding: 4px;
  outline: none;
}

.app-select-list:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(245, 124, 0, 0.25);
}

.app-select-option {
  position: relative;
  padding: 6px 10px 6px 26px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 300;
  cursor: pointer;
}

.app-select-option.is-active {
  background: #fff8ef;
}

.app-select-option[aria-selected="true"] {
  font-weight: 500;
  color: #3a260b;
}

.app-select-option[aria-selected="true"]::before {
  content: "✓";
  position: absolute;
  left: 9px;
  color: var(--accent);
}

.app-select-empty {
  max-width: 280px;
  margin: 0;
  padding: 8px;
  font-size: 0.74rem;
  color: var(--muted);
}

.app-dialog {
  width: min(420px, 92vw);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 40px rgba(17, 17, 17, 0.2);
  color: var(--text);
}

.app-dialog::backdrop {
  background: rgba(17, 17, 17, 0.35);
}

.app-dialog-body {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.app-dialog-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
}

.app-dialog-message {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 300;
  line-height: 1.45;
  color: #333;
  overflow-wrap: anywhere;
}

.app-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 4px;
}

/* emoji-mart draws its own frame and shadow */
.app-popover.emoji-popover {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.popover-form {
  width: 260px;
  padding: 10px;
  display: grid;
  gap: 6px;
}

.popover-form-title {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 500;
}

.popover-form-fields {
  display: grid;
  gap: 8px;
}

.popover-form-fields--2 {
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.popover-form-hint {
  display: block;
  margin-top: 3px;
  font-size: 0.68rem;
  color: var(--muted);
}

.popover-form-fields label {
  margin: 0;
}

.popover-form-error {
  margin: 0;
}

.popover-form-error:empty {
  display: none;
}

.popover-form-actions {
  display: flex;
  gap: 6px;
}

.edit-heading {
  margin: 0 0 8px;
  font-size: 0.95rem;
  font-weight: 500;
}

.runtime-helper-toolbar {
  display: grid;
  gap: 6px;
  margin-top: 2px;
}

.runtime-helper-group {
  display: grid;
  gap: 3px;
}

.runtime-helper-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.form-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

button.btn-secondary {
  background: #fff;
  color: #252525;
  border: 1px solid var(--line);
}

button.btn-secondary:hover {
  background: #fff8ef;
  border-color: var(--accent);
}

.runtime-helper-toolbar button {
  background: #fff;
  color: #252525;
  border: 1px solid var(--line);
  min-height: 28px;
  padding: 4px 8px;
  font-size: 0.71rem;
}

.runtime-helper-toolbar .link-btn {
  border: 0;
  background: transparent;
  color: #424242;
  text-decoration: none;
  padding: 0 2px;
  min-height: auto;
  font-size: 0.72rem;
}

.runtime-help-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #fffaf2;
}

.runtime-help-panel h4 {
  margin: 0 0 6px;
}

.runtime-help-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 5px;
}

.runtime-help-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: center;
}

.runtime-help-list code {
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 6px;
  font-size: 0.7rem;
  overflow-wrap: anywhere;
}

.runtime-help-list button {
  min-height: 26px;
  padding: 4px 8px;
  font-size: 0.7rem;
}

.image-panel {
  margin-top: 8px;
  border: 1px dashed #e2e2e2;
  border-radius: 8px;
  padding: 8px;
}

.image-actions {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

/* visually hidden, still focusable and still what the label opens */
.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  opacity: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.file-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 31px;
  margin: 0;
  padding: 6px 11px;
  border: 1px dashed #cfcfcf;
  border-radius: var(--radius-sm);
  background: #fff;
  color: #252525;
  font-size: 0.78rem;
  font-weight: 400;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.file-button::before {
  content: "";
  width: 14px;
  height: 14px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f57c00' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='3'/%3E%3Ccircle cx='8.5' cy='8.5' r='1.5'/%3E%3Cpath d='M21 15l-5-5L5 21'/%3E%3C/svg%3E") center / contain no-repeat;
}

.file-button:hover,
.file-button.is-dragover {
  border-color: var(--accent);
  background: #fff8ef;
}

.file-input:focus-visible + .file-button {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(245, 124, 0, 0.2);
}

.file-name {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.74rem;
  font-weight: 300;
  color: var(--muted);
}

.image-thumb {
  display: block;
  margin-top: 6px;
  max-width: 160px;
  max-height: 160px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
}

.preview {
  margin-top: 10px;
}

.preview-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 64px;
  padding: 8px;
  background: #fff;
  font-size: 0.8rem;
  font-weight: 300;
  line-height: 1.45;
}

.template-view {
  display: grid;
  gap: 8px;
}

.template-view-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.template-view-heading {
  min-width: 0;
}

.template-view-heading h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.template-view-shortcuts {
  margin: 3px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.78rem;
}

.template-view-shortcut {
  color: var(--accent);
  font-weight: 500;
}

.template-view-aliases {
  color: var(--muted);
  font-weight: 300;
}

.template-view-header > button {
  flex: 0 0 auto;
}

.template-view-caption {
  margin: 4px 0 0;
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chat-preview {
  background: #f1eee4;
  border-radius: var(--radius-md);
  padding: 16px;
}

.chat-bubble {
  max-width: 520px;
  margin-left: auto;
  background: #fff;
  border-radius: 14px 14px 4px 14px;
  box-shadow: 0 1px 2px rgba(17, 17, 17, 0.08);
  padding: 9px 12px;
}

.chat-bubble-text {
  font-size: 0.85rem;
  font-weight: 300;
  line-height: 1.5;
  color: #1d1d1d;
  overflow-wrap: anywhere;
}

.chat-bubble-text:empty {
  display: none;
}

.chat-bubble-image {
  display: block;
  max-width: 100%;
  max-height: 360px;
  margin-top: 8px;
  border-radius: 10px;
}

.template-view-empty {
  display: grid;
  place-items: center;
  min-height: 220px;
  text-align: center;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.auth-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}

.link-btn {
  border: 0;
  background: transparent;
  color: #2f2f2f;
  padding: 0;
  min-height: auto;
  text-decoration: none;
  font-weight: 200;
}

.link-btn:hover {
  color: var(--accent);
}

#cabinet-panel,
#admin-panel {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding-bottom: 2px;
}

.admin-tabs button {
  background: #fff;
  color: #2d2d2d;
  border-color: var(--line);
  min-height: 29px;
  padding: 5px 8px;
}

.admin-tabs button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.admin-tab-section {
  display: grid;
  gap: 8px;
}

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

.promo-used-month {
  border: 0;
  padding: 2px 0;
  color: var(--muted);
  font-weight: 600;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 17, 17, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 14px;
}

.modal-card {
  width: min(430px, 94vw);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 12px;
  box-shadow: 0 12px 34px rgba(17, 17, 17, 0.14);
}

.modal-card h3 {
  margin: 0 0 6px;
  font-size: 0.9rem;
  font-weight: 300;
}

.modal-actions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.panel-app .stack-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #fff;
}

.turnstile-block {
  margin-top: 8px;
  padding: 8px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fffaf2;
}

.cabinet-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.cabinet-card-devices {
  grid-column: 1 / -1;
}

.app-footer {
  width: min(1180px, 94vw);
  margin: 0 auto 12px;
  border-top: 1px solid var(--line);
}

.app-footer-inner {
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 2px 2px;
  color: #222222;
  font-size: 0.72rem;
  font-weight: 200;
  text-align: center;
}

.app-footer-inner a,
.app-footer-inner a:visited {
  color: #111111;
  text-decoration: none;
  transition: color 0.2s ease;
}

.app-footer-inner a:hover {
  color: var(--accent) !important;
}

label input[type="checkbox"] {
  width: auto;
  margin-top: 0;
  margin-right: 6px;
}

@media (max-width: 980px) {
  .split {
    grid-template-columns: 1fr;
  }

  /* stacked: the list keeps its own fixed-height scroll box, so filtering doesn't
     move the panel below it */
  .sidebar {
    height: 60vh;
  }

  .editor {
    max-height: none;
  }

  .grid2 {
    grid-template-columns: 1fr;
  }

  .image-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .cabinet-grid {
    grid-template-columns: 1fr;
  }

  .brand-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .brand-header-logo {
    width: 150px;
  }

  .app-footer {
    width: min(1200px, 94vw);
  }
}
