:root {
  color-scheme: light;
  --bg: #f4fbff;
  --panel: #ffffff;
  --panel-soft: #eef8ff;
  --text: #17324d;
  --muted: #65798d;
  --line: #d8edf9;
  --accent: #1b9fe8;
  --accent-strong: #0878bd;
  --green: #12a37f;
  --yellow: #cc8500;
  --red: #d93f4a;
  --shadow: 0 18px 50px rgba(30, 128, 180, .12);
  --radius: 8px;
  --font-family: IRANSans, "IRANSansWeb", "IranSans", "Iran Sans", Tahoma, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  font-family: inherit;
}

html {
  direction: rtl;
  font-family: var(--font-family);
}

body {
  margin: 0;
  background: linear-gradient(180deg, #f2fbff 0%, #f8fcff 42%, #ffffff 100%);
  color: var(--text);
  font-family: var(--font-family);
  font-size: 14px;
}

a { color: inherit; text-decoration: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar__inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 24px;
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 900; }
.brand__mark {
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #54c7ff);
}
.brand__sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

.nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.nav a, .btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius);
  padding: 10px 13px;
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-strong); }
.btn--ghost { background: transparent; }
.btn--danger { color: var(--red); }
.btn:disabled { opacity: .58; cursor: not-allowed; }

.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 16px;
  padding: 18px;
}

.sidebar, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.sidebar {
  min-height: calc(100vh - 100px);
  padding: 14px;
}

.side-title { font-weight: 900; margin-bottom: 12px; }
.side-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 10px;
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 800;
}
.side-link:hover, .side-link.is-active { background: var(--panel-soft); color: var(--accent-strong); }

.content { min-width: 0; }
.panel__head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, #f7fcff);
}
.panel__title { margin: 0; font-size: 20px; }
.panel__sub { color: var(--muted); margin-top: 6px; line-height: 1.8; }
.panel__body { padding: 18px 20px; }

.messages { display: grid; gap: 10px; margin-bottom: 14px; }
.message {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.message.success { border-color: #bdeee1; background: #eefcf8; color: #08745b; }
.message.error { border-color: #ffd3d6; background: #fff3f4; color: var(--red); }

.auth-shell {
  min-height: calc(100vh - 66px);
  display: grid;
  place-items: center;
  padding: 28px 16px;
}
.auth-card {
  width: min(520px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.form-grid { display: grid; gap: 12px; }
.form-row { display: grid; gap: 7px; }
label { font-weight: 800; color: #284764; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 12px;
  color: var(--text);
  background: #fff;
  outline: none;
  font-family: var(--font-family);
}
input:focus, select:focus, textarea:focus {
  border-color: #8dd5ff;
  box-shadow: 0 0 0 4px rgba(27, 159, 232, .12);
}
.field-error { color: var(--red); font-size: 12px; line-height: 1.8; }
.field-hint { color: var(--muted); font-size: 12px; line-height: 1.8; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.stat {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius);
  padding: 16px;
}
.stat__num { font-size: 26px; font-weight: 900; color: var(--accent-strong); }
.stat__label { color: var(--muted); margin-top: 4px; }

.tree-page {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) 360px;
  gap: 16px;
}

.tree-workspace {
  display: grid;
  gap: 14px;
}

.tree-actionbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fff, #f4fbff);
  padding: 12px;
}

.tree-actionbar__title {
  font-weight: 900;
}

.tree-actionbar__sub {
  color: var(--muted);
  margin-top: 5px;
  font-size: 13px;
}

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

.tree-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.tree {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  min-height: 420px;
  padding: 8px;
  overflow: auto;
}
.tree--full {
  min-height: 460px;
}
.tree ul { list-style: none; margin: 0; padding: 0 20px 0 0; }
.tree > ul { padding-right: 0; }
.tree--full ul { padding: 0; }
.tree-node { margin: 4px 0; }
.tree-row {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  min-height: 34px;
  padding: 4px 8px;
  cursor: pointer;
}
.tree--full .tree-row {
  padding-right: calc(6px + (var(--depth, 0) * 20px));
}
.tree-row--root {
  background: #eaf7ff;
  border-color: #b4e4ff;
}
.tree-row:hover { background: #f7fcff; border-color: var(--line); }
.tree-row.is-selected { background: #e9f7ff; border-color: #a8ddfb; }
.tree-row.is-drop { outline: 2px solid #54c7ff; }
.tree-row.is-dragging { opacity: .55; }
.tree-row.is-drop-before,
.tree-row.is-drop-after {
  position: relative;
}
.tree-row.is-drop-before::before,
.tree-row.is-drop-after::after {
  content: "";
  position: absolute;
  left: 8px;
  right: calc(8px + (var(--depth, 0) * 20px));
  height: 3px;
  border-radius: 999px;
  background: #1b9fe8;
  box-shadow: 0 0 0 3px rgba(27, 159, 232, .13);
}
.tree-row.is-drop-before::before { top: -4px; }
.tree-row.is-drop-after::after { bottom: -4px; }
.tree-title { font-weight: 900; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-toggle {
  width: 22px;
  height: 22px;
  border: 1px solid #c8dfeb;
  border-radius: 4px;
  background: #fff;
  color: var(--accent-strong);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-weight: 900;
  line-height: 1;
}
.tree-toggle:disabled {
  border-color: transparent;
  background: transparent;
  cursor: default;
}
.node-icon { width: 22px; height: 22px; border-radius: 5px; display: grid; place-items: center; background: var(--panel-soft); color: var(--accent-strong); font-weight: 900; font-size: 12px; }
.badge {
  font-size: 12px;
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #fff;
  white-space: nowrap;
}
.badge.ready { color: var(--green); border-color: #bdeee1; background: #eefcf8; }
.badge.pending, .badge.queued { color: var(--yellow); border-color: #ffe1a8; background: #fff8ea; }
.badge.processing { color: var(--accent-strong); border-color: #b7e6ff; background: #eef9ff; }
.badge.failed { color: var(--red); border-color: #ffd3d6; background: #fff3f4; }
.badge.root { color: var(--accent-strong); border-color: #b7e6ff; background: #eef9ff; }
.drop-root {
  border: 1px dashed #9edcff;
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 10px;
  color: var(--muted);
  text-align: center;
}
.drop-root.is-drop { background: #eef9ff; color: var(--accent-strong); }

.toolbox { display: grid; gap: 12px; }
.tool-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 14px;
}
.tool-title { font-weight: 900; margin-bottom: 10px; }
.selected-box {
  border: 1px solid #b7e6ff;
  background: #eef9ff;
  border-radius: var(--radius);
  padding: 10px;
  color: var(--accent-strong);
  font-weight: 800;
}
.toast {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 50;
  display: grid;
  gap: 8px;
}
.toast-item {
  background: #17324d;
  color: #fff;
  border-radius: var(--radius);
  padding: 10px 12px;
  box-shadow: var(--shadow);
}

.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(13, 43, 68, .34);
  backdrop-filter: blur(8px);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  width: min(520px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 24px 80px rgba(23, 50, 77, .18);
  padding: 16px;
}

.modal-card--wide {
  width: min(760px, 100%);
}

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

.modal-head h2 {
  margin: 0;
  font-size: 18px;
}

.modal-close {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.modal-close:hover {
  color: var(--red);
  background: #fff7f8;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.modal-note {
  color: var(--muted);
  line-height: 1.9;
  margin: 0;
}

.modal-error {
  border: 1px solid #ffd3d6;
  background: #fff3f4;
  color: var(--red);
  border-radius: var(--radius);
  padding: 10px 12px;
  line-height: 1.8;
}

.panel--spaced {
  margin-top: 16px;
}

.panel__head--actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.data-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  vertical-align: middle;
}

.data-table th {
  background: #f2fbff;
  color: #284764;
  font-weight: 900;
  white-space: nowrap;
}

.data-table tbody tr:hover {
  background: #f8fcff;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.table-actions {
  text-align: center !important;
  white-space: nowrap;
}

.table-actions > .btn,
.table-actions > form {
  margin-inline: 3px;
}

.table-actions > .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

.table-actions form {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-block: 0;
  vertical-align: middle;
}

.empty-cell {
  color: var(--muted);
  text-align: center !important;
  padding: 28px 14px !important;
}

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

.license-form {
  display: grid;
  gap: 16px;
}

.license-form__grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) minmax(180px, .8fr) minmax(140px, .5fr);
  align-items: start;
  gap: 12px;
}

.student-search__selected {
  min-height: 30px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.student-search {
  position: relative;
}

.student-search__results {
  display: grid;
  gap: 6px;
  max-height: 230px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 6px;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  z-index: 30;
  box-shadow: 0 16px 42px rgba(23, 50, 77, .12);
}

.student-search__results[hidden] {
  display: none;
}

.student-search__item {
  width: 100%;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  text-align: right;
}

.student-search__item:hover {
  border-color: #b7e6ff;
  background: #eef9ff;
}

.student-search__name {
  font-weight: 900;
}

.student-search__meta,
.student-search__empty {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

.student-search__empty {
  padding: 9px 10px;
}

.license-tree {
  min-height: 220px;
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 8px;
}

.license-tree__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.license-tree__item {
  margin: 4px 0;
}

.license-tree__row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  padding: 9px calc(10px + (var(--depth, 0) * 24px)) 9px 10px;
  text-align: right;
}

.license-tree__row:hover {
  border-color: var(--line);
  background: #f7fcff;
}

.license-tree__row.is-selected {
  border-color: #8dd5ff;
  background: #e9f7ff;
}

.license-tree__title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 900;
}

.license-tree__empty {
  color: var(--muted);
  padding: 10px;
  line-height: 1.8;
}

.license-target-picker {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 12px;
}

.windows-tree {
  max-height: min(52vh, 430px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 8px;
}

.windows-tree__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.windows-tree__item {
  margin: 2px 0;
}

.windows-tree__row {
  min-height: 32px;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 3px 8px 3px 6px;
  padding-right: calc(6px + (var(--depth, 0) * 18px));
}

.windows-tree__row:hover {
  border-color: var(--line);
  background: #f7fcff;
}

.windows-tree__toggle {
  width: 20px;
  height: 20px;
  border: 1px solid #c8dfeb;
  border-radius: 4px;
  background: #fff;
  color: var(--accent-strong);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-weight: 900;
  line-height: 1;
}

.windows-tree__toggle:disabled {
  border-color: transparent;
  background: transparent;
  cursor: default;
}

.windows-tree__checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  flex: 0 0 auto;
}

.windows-tree__title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.windows-tree__empty {
  color: var(--muted);
  line-height: 1.8;
  padding: 10px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-weight: 900;
  white-space: nowrap;
}

.status-pill.active {
  color: var(--green);
  border-color: #bdeee1;
  background: #eefcf8;
}

.status-pill.inactive,
.status-pill.revoked {
  color: var(--red);
  border-color: #ffd3d6;
  background: #fff3f4;
}

.status-pill.blocked,
.status-pill.denied,
.status-pill.error {
  color: var(--red);
  border-color: #ffd3d6;
  background: #fff3f4;
}

.status-pill.success {
  color: var(--green);
  border-color: #bdeee1;
  background: #eefcf8;
}

.status-pill.throttled {
  color: var(--yellow);
  border-color: #ffe1a8;
  background: #fff8ea;
}

.code-pill {
  display: inline-flex;
  direction: ltr;
  border: 1px solid #b7e6ff;
  border-radius: var(--radius);
  background: #eef9ff;
  color: var(--accent-strong);
  padding: 6px 8px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-weight: 800;
  line-height: 1.6;
  max-width: min(560px, 62vw);
  white-space: normal;
  word-break: break-all;
}

.code-pill--short {
  max-width: 150px;
  padding-block: 4px;
}

.inline-link {
  color: var(--accent-strong);
  font-weight: 900;
}

.data-table--compact th,
.data-table--compact td {
  padding: 9px 10px;
  font-size: 13px;
}

.license-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.detail-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fcff;
  padding: 11px 12px;
  display: grid;
  gap: 5px;
}

.detail-row span,
.license-code-block span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.detail-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.license-code-block {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
}

.event-filter {
  display: grid;
  grid-template-columns: minmax(240px, 1.4fr) minmax(160px, .8fr) minmax(160px, .8fr) minmax(220px, 1fr) auto;
  align-items: end;
  gap: 12px;
}

.event-filter__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.pagination__item,
.pagination__meta {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 8px 11px;
  font-weight: 800;
}

.pagination__meta {
  color: var(--muted);
}

.pagination__item.is-disabled {
  opacity: .55;
}

.watermark-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}

.watermark-editor {
  display: grid;
  gap: 14px;
}

.settings-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 14px;
  display: grid;
  gap: 14px;
}

.settings-section__title {
  margin: 0;
  font-size: 16px;
  color: #17324d;
}

.toggle-line,
.check-tile {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 900;
  color: #284764;
}

.toggle-line input,
.check-tile input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  flex: 0 0 auto;
}

.watermark-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.check-tile {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fcff;
  padding: 10px;
}

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

.watermark-controls--compact {
  align-items: end;
}

.range-control {
  display: grid;
  grid-template-columns: 1fr 42px 36px;
  align-items: center;
  gap: 8px;
}

.range-control input[type="range"] {
  padding: 0;
  accent-color: var(--accent);
}

.range-control output {
  direction: ltr;
  text-align: center;
  font-weight: 900;
  color: var(--accent-strong);
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.watermark-preview {
  position: sticky;
  top: 82px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fff, #f7fcff);
  padding: 14px;
  display: grid;
  gap: 12px;
}

.watermark-preview__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.watermark-preview__title {
  font-weight: 900;
}

.watermark-preview__meta {
  color: var(--muted);
  font-size: 12px;
}

.watermark-screen {
  --preview-wm-opacity: .34;
  --preview-wm-size: 15px;
  --preview-wm-angle: -18deg;
  --preview-static-opacity: .46;
  --preview-static-size: 13px;
  --preview-static-angle: 0deg;
  --preview-static-margin: 5%;
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid #dbeafe;
  background:
    radial-gradient(circle at 35% 30%, rgba(105, 167, 255, .18), transparent 26%),
    linear-gradient(135deg, #06111f, #0b1b2f 56%, #102944);
  color: #fff;
}

.watermark-screen.is-disabled::after {
  content: "واترمارک غیرفعال";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, .72);
  font-weight: 900;
  background: rgba(6, 17, 31, .42);
}

.watermark-screen__video-title {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 900;
  color: rgba(255, 255, 255, .22);
}

.watermark-screen__marks span,
.watermark-screen__static span {
  position: absolute;
  font-size: var(--preview-wm-size);
  opacity: var(--preview-wm-opacity);
  transform: rotate(var(--preview-wm-angle));
  font-weight: 900;
  color: #fff;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .72);
  white-space: nowrap;
  user-select: none;
  pointer-events: none;
}

.watermark-screen__marks span {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.watermark-screen__static span {
  max-width: 74%;
  font-size: var(--preview-static-size);
  opacity: var(--preview-static-opacity);
  transform: translate(-50%, -50%) rotate(var(--preview-static-angle));
  overflow: hidden;
  text-overflow: ellipsis;
}

.watermark-screen__static span[data-position="top-right"] {
  top: var(--preview-static-margin);
  right: var(--preview-static-margin);
  transform: translate(0, 0) rotate(var(--preview-static-angle));
}

.watermark-screen__static span[data-position="top-left"] {
  top: var(--preview-static-margin);
  left: var(--preview-static-margin);
  transform: translate(0, 0) rotate(var(--preview-static-angle));
}

.watermark-screen__static span[data-position="top-center"] {
  top: var(--preview-static-margin);
  right: 50%;
}

.watermark-screen__static span[data-position="center"] {
  top: 50%;
  right: 50%;
}

.watermark-screen__static span[data-position="bottom-right"] {
  right: var(--preview-static-margin);
  bottom: calc(var(--preview-static-margin) + 24px);
  transform: translate(0, 0) rotate(var(--preview-static-angle));
}

.watermark-screen__static span[data-position="bottom-left"] {
  left: var(--preview-static-margin);
  bottom: calc(var(--preview-static-margin) + 24px);
  transform: translate(0, 0) rotate(var(--preview-static-angle));
}

.watermark-screen__static span[data-position="bottom-center"] {
  right: 50%;
  bottom: calc(var(--preview-static-margin) + 24px);
}

.watermark-screen__controls {
  position: absolute;
  right: 14px;
  left: 14px;
  bottom: 12px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .16);
}

.watermark-screen__controls::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 42%;
  border-radius: inherit;
  background: rgba(255, 255, 255, .8);
}

.quota-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.quota-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fff, #f4fbff);
  padding: 14px;
  display: grid;
  gap: 5px;
}

.quota-card__label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.quota-card strong {
  color: var(--accent-strong);
  font-size: 20px;
}

.filter-form {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.filter-form .form-row {
  min-width: min(280px, 100%);
}

.status-pill.pending,
.status-pill.queued,
.status-pill.retrying {
  color: var(--yellow);
  background: #fff8e6;
  border-color: #f5d27d;
}

.status-pill.paid,
.status-pill.succeeded {
  color: var(--green);
  background: #eefcf8;
  border-color: #bdeee1;
}

.status-pill.failed,
.status-pill.canceled,
.status-pill.expired {
  color: var(--red);
  background: #fff3f4;
  border-color: #ffd3d6;
}

@media (max-width: 980px) {
  .layout, .tree-page, .license-form__grid, .license-target-picker, .watermark-layout, .watermark-controls, .event-filter { grid-template-columns: 1fr; }
  .sidebar { min-height: auto; }
  .watermark-preview { position: static; }
}

@media (max-width: 620px) {
  .topbar__inner { align-items: flex-start; flex-direction: column; padding: 12px 16px; }
  .nav { width: 100%; }
  .nav a, .btn { flex: 1; }
  .stats { grid-template-columns: 1fr; }
  .form-columns { grid-template-columns: 1fr; }
}
