:root {
  --panel: rgba(4, 20, 18, 0.72);
  --panel-border: rgba(105, 255, 214, 0.24);
  --text: #ddfff7;
  --muted: #84b8ac;
  --accent: #63ffd6;
  --accent-strong: #0affb9;
  --shadow: 0 0 0 1px rgba(99, 255, 214, 0.1), 0 16px 44px rgba(0, 0, 0, 0.38), 0 0 40px rgba(10, 255, 185, 0.08);
  --footer-safe-space: 170px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body,
.rows,
.hierarchy-panel,
.template-list,
.admin-table-wrap,
.upload-results,
.results-grid,
.library-table-wrap {
  scrollbar-width: thin;
  scrollbar-color: rgba(98, 255, 216, 0.9) rgba(5, 25, 21, 0.82);
  scroll-behavior: smooth;
}

body::-webkit-scrollbar,
.rows::-webkit-scrollbar,
.hierarchy-panel::-webkit-scrollbar,
.template-list::-webkit-scrollbar,
.admin-table-wrap::-webkit-scrollbar,
.upload-results::-webkit-scrollbar,
.results-grid::-webkit-scrollbar,
.library-table-wrap::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

body::-webkit-scrollbar-track,
.rows::-webkit-scrollbar-track,
.hierarchy-panel::-webkit-scrollbar-track,
.template-list::-webkit-scrollbar-track,
.admin-table-wrap::-webkit-scrollbar-track,
.upload-results::-webkit-scrollbar-track,
.results-grid::-webkit-scrollbar-track,
.library-table-wrap::-webkit-scrollbar-track {
  background:
    linear-gradient(180deg, rgba(8, 28, 23, 0.9), rgba(3, 16, 13, 0.94));
  border-radius: 999px;
  box-shadow:
    inset 0 0 0 1px rgba(99, 255, 214, 0.12),
    inset 0 0 20px rgba(7, 48, 39, 0.3);
}

body::-webkit-scrollbar-thumb,
.rows::-webkit-scrollbar-thumb,
.hierarchy-panel::-webkit-scrollbar-thumb,
.template-list::-webkit-scrollbar-thumb,
.admin-table-wrap::-webkit-scrollbar-thumb,
.upload-results::-webkit-scrollbar-thumb,
.results-grid::-webkit-scrollbar-thumb,
.library-table-wrap::-webkit-scrollbar-thumb {
  background:
    linear-gradient(180deg, rgba(152, 255, 232, 0.98), rgba(92, 255, 214, 0.96) 46%, rgba(16, 201, 155, 0.98));
  border-radius: 999px;
  border: 2px solid rgba(5, 22, 19, 0.92);
  box-shadow:
    0 0 12px rgba(91, 255, 214, 0.3),
    0 0 24px rgba(12, 179, 139, 0.18);
}

body::-webkit-scrollbar-thumb:hover,
.rows::-webkit-scrollbar-thumb:hover,
.hierarchy-panel::-webkit-scrollbar-thumb:hover,
.template-list::-webkit-scrollbar-thumb:hover,
.admin-table-wrap::-webkit-scrollbar-thumb:hover,
.upload-results::-webkit-scrollbar-thumb:hover,
.results-grid::-webkit-scrollbar-thumb:hover,
.library-table-wrap::-webkit-scrollbar-thumb:hover {
  background:
    linear-gradient(180deg, rgba(188, 255, 240, 0.99), rgba(111, 255, 222, 0.98) 48%, rgba(22, 223, 172, 0.99));
  box-shadow:
    0 0 16px rgba(111, 255, 222, 0.42),
    0 0 28px rgba(20, 198, 153, 0.24);
}

body::-webkit-scrollbar-corner,
.rows::-webkit-scrollbar-corner,
.hierarchy-panel::-webkit-scrollbar-corner,
.template-list::-webkit-scrollbar-corner,
.admin-table-wrap::-webkit-scrollbar-corner,
.upload-results::-webkit-scrollbar-corner,
.results-grid::-webkit-scrollbar-corner,
.library-table-wrap::-webkit-scrollbar-corner {
  background: transparent;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(20, 120, 96, 0.18), transparent 36%),
    radial-gradient(circle at 20% 20%, rgba(8, 255, 191, 0.14), transparent 16%),
    radial-gradient(circle at 80% 15%, rgba(8, 255, 191, 0.1), transparent 14%),
    linear-gradient(180deg, #071715 0%, #03100f 45%, #010605 100%);
}

body {
  position: relative;
  overflow-x: hidden;
}

.sky,
.aurora {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.sky {
  background-image:
    radial-gradient(circle at 4% 18%, rgba(255, 255, 255, 0.9) 0 1px, transparent 1.5px),
    radial-gradient(circle at 7% 58%, rgba(255, 255, 255, 0.6) 0 1px, transparent 1.5px),
    radial-gradient(circle at 10% 84%, rgba(255, 255, 255, 0.7) 0 1px, transparent 1.5px),
    radial-gradient(circle at 14% 64%, rgba(255, 255, 255, 0.55) 0 1px, transparent 1.5px),
    radial-gradient(circle at 18% 42%, rgba(255, 255, 255, 0.75) 0 1px, transparent 1.5px),
    radial-gradient(circle at 22% 78%, rgba(255, 255, 255, 0.5) 0 1px, transparent 1.5px),
    radial-gradient(circle at 26% 12%, rgba(255, 255, 255, 0.5) 0 1px, transparent 1.5px),
    radial-gradient(circle at 31% 56%, rgba(255, 255, 255, 0.72) 0 1px, transparent 1.5px),
    radial-gradient(circle at 35% 84%, rgba(255, 255, 255, 0.62) 0 1px, transparent 1.5px),
    radial-gradient(circle at 40% 16%, rgba(255, 255, 255, 0.8) 0 1px, transparent 1.5px),
    radial-gradient(circle at 47% 31%, rgba(255, 255, 255, 0.7) 0 1px, transparent 1.5px),
    radial-gradient(circle at 52% 68%, rgba(255, 255, 255, 0.58) 0 1px, transparent 1.5px),
    radial-gradient(circle at 58% 48%, rgba(255, 255, 255, 0.84) 0 1px, transparent 1.5px),
    radial-gradient(circle at 64% 13%, rgba(255, 255, 255, 0.72) 0 1px, transparent 1.5px),
    radial-gradient(circle at 69% 76%, rgba(255, 255, 255, 0.52) 0 1px, transparent 1.5px),
    radial-gradient(circle at 72% 28%, rgba(255, 255, 255, 0.88) 0 1px, transparent 1.5px),
    radial-gradient(circle at 77% 60%, rgba(255, 255, 255, 0.52) 0 1px, transparent 1.5px),
    radial-gradient(circle at 81% 16%, rgba(255, 255, 255, 0.65) 0 1px, transparent 1.5px),
    radial-gradient(circle at 84% 44%, rgba(255, 255, 255, 0.55) 0 1px, transparent 1.5px),
    radial-gradient(circle at 88% 34%, rgba(255, 255, 255, 0.9) 0 1px, transparent 1.5px),
    radial-gradient(circle at 91% 70%, rgba(255, 255, 255, 0.66) 0 1px, transparent 1.5px),
    radial-gradient(circle at 95% 88%, rgba(255, 255, 255, 0.6) 0 1px, transparent 1.5px),
    radial-gradient(circle at 97% 24%, rgba(255, 255, 255, 0.7) 0 1px, transparent 1.5px);
  opacity: 0.78;
}

.aurora {
  filter: blur(70px);
  opacity: 0.35;
}

.aurora-left {
  background: radial-gradient(circle at 20% 20%, rgba(0, 255, 183, 0.35), transparent 34%);
}

.aurora-right {
  background: radial-gradient(circle at 80% 10%, rgba(0, 194, 145, 0.28), transparent 32%);
}

.page {
  position: relative;
  z-index: 1;
  width: min(1500px, calc(100% - 28px));
  margin: 0 auto;
  padding: 20px 0 96px;
}

.auth-gate {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
}

.page.app-hidden,
.auth-gate.auth-hidden {
  display: none;
}

.auth-gate::before,
.auth-gate::after {
  content: "";
  position: absolute;
  inset: auto;
  width: 22vw;
  height: 22vw;
  min-width: 180px;
  min-height: 180px;
  border-radius: 46% 54% 58% 42% / 42% 38% 62% 58%;
  filter: blur(24px);
  opacity: 0.34;
  pointer-events: none;
}

.auth-gate::before {
  left: 12%;
  top: 16%;
  background:
    radial-gradient(circle at 34% 36%, rgba(168, 255, 240, 0.98) 0%, rgba(80, 255, 214, 0.82) 16%, rgba(19, 205, 154, 0.38) 36%, transparent 58%),
    radial-gradient(ellipse at 50% 50%, rgba(96, 255, 223, 0.52) 0%, rgba(96, 255, 223, 0.24) 22%, transparent 56%),
    conic-gradient(from 0deg, transparent 0deg 24deg, rgba(135, 255, 232, 0.5) 24deg 34deg, transparent 34deg 74deg, rgba(82, 255, 209, 0.42) 74deg 86deg, transparent 86deg 138deg, rgba(113, 255, 225, 0.32) 138deg 148deg, transparent 148deg 360deg);
  animation: paintFloatLeft 12s ease-in-out infinite;
}

.auth-gate::after {
  right: 10%;
  bottom: 14%;
  background:
    radial-gradient(circle at 58% 42%, rgba(159, 255, 235, 0.92) 0%, rgba(88, 255, 214, 0.76) 18%, rgba(14, 196, 148, 0.34) 38%, transparent 58%),
    radial-gradient(ellipse at 50% 50%, rgba(96, 255, 223, 0.48) 0%, rgba(96, 255, 223, 0.2) 20%, transparent 56%),
    conic-gradient(from 18deg, transparent 0deg 28deg, rgba(144, 255, 233, 0.46) 28deg 40deg, transparent 40deg 102deg, rgba(82, 255, 209, 0.36) 102deg 114deg, transparent 114deg 210deg, rgba(116, 255, 226, 0.32) 210deg 220deg, transparent 220deg 360deg);
  animation: paintFloatRight 14s ease-in-out infinite;
}

.auth-card {
  position: relative;
  width: min(460px, 100%);
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  overflow: hidden;
}

.auth-card::before,
.auth-card::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(18px);
  opacity: 0.2;
}

.auth-card::before {
  width: 120px;
  height: 120px;
  left: -18px;
  top: -12px;
  background:
    radial-gradient(circle, rgba(133, 255, 229, 0.56) 0%, rgba(38, 212, 166, 0.16) 44%, transparent 72%),
    conic-gradient(from 0deg, transparent 0deg 28deg, rgba(132, 255, 228, 0.36) 28deg 40deg, transparent 40deg 360deg);
  animation: paintDriftInner 9s ease-in-out infinite;
}

.auth-card::after {
  width: 96px;
  height: 96px;
  right: -12px;
  bottom: -10px;
  background:
    radial-gradient(circle, rgba(161, 255, 237, 0.44) 0%, rgba(26, 160, 127, 0.14) 42%, transparent 72%),
    conic-gradient(from 32deg, transparent 0deg 34deg, rgba(124, 255, 226, 0.26) 34deg 46deg, transparent 46deg 360deg);
  animation: paintDriftInner 11s ease-in-out infinite reverse;
}

.auth-head {
  align-items: start;
}

.auth-head h1 {
  margin: 4px 0 0;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-remember {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-remember input {
  width: auto;
}

.auth-message {
  min-height: 20px;
  color: #ff9ab4;
}

@keyframes paintFloatLeft {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
  }
  33% {
    transform: translate3d(28px, -18px, 0) rotate(18deg) scale(1.12);
  }
  66% {
    transform: translate3d(-14px, 20px, 0) rotate(-12deg) scale(0.9);
  }
  100% {
    transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
  }
}

@keyframes paintFloatRight {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
  }
  30% {
    transform: translate3d(-24px, -16px, 0) rotate(-16deg) scale(0.92);
  }
  65% {
    transform: translate3d(18px, 20px, 0) rotate(14deg) scale(1.1);
  }
  100% {
    transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
  }
}

@keyframes paintDriftInner {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(14px, -10px, 0) scale(1.16) rotate(10deg);
  }
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
}

.tab-nav {
  display: flex;
  gap: 12px;
  position: sticky;
  top: 14px;
  z-index: 5;
  align-items: center;
  justify-content: space-between;
  background: rgba(4, 20, 18, 0.84);
  backdrop-filter: blur(18px);
}

.tab-nav-left {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.session-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.session-user {
  color: var(--muted);
  white-space: nowrap;
}

.tab-button {
  color: var(--text);
  background: rgba(99, 255, 214, 0.08);
  border: 1px solid rgba(99, 255, 214, 0.16);
}

.tab-button.is-active {
  color: #03231d;
  background: linear-gradient(135deg, var(--accent-strong), #9bffe6);
  box-shadow: 0 12px 28px rgba(10, 255, 185, 0.25);
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

.panel {
  margin-bottom: 18px;
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  min-width: 0;
}

.row-label {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 12px;
}

.steps,
.rows,
.form-grid,
.geo-presets,
.geo-link-grid,
.template-layout,
.template-list,
.template-card-grid {
  display: grid;
  gap: 14px;
}

.step-card,
.row-card,
.geo-card {
  border: 1px solid rgba(99, 255, 214, 0.18);
  border-radius: 20px;
  background: rgba(2, 14, 12, 0.7);
}

.step-card,
.geo-card {
  padding: 16px;
}

.step-card p,
.section-head span,
label {
  color: var(--muted);
}

.section-head,
.row-topline,
.creative-tools,
.actions,
.template-apply-bar,
.template-card-actions,
.template-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.section-head {
  margin-bottom: 16px;
  align-items: flex-start;
}

.editor-head {
  position: sticky;
  top: 92px;
  z-index: 4;
  padding: 10px 12px;
  margin: -4px -4px 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(4, 20, 18, 0.96), rgba(4, 20, 18, 0.84));
  backdrop-filter: blur(12px);
  border: 1px solid rgba(99, 255, 214, 0.14);
}

.editor-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.section-head h2,
.row-topline h3 {
  margin: 0;
}

.rows {
  grid-template-columns: 1fr;
  max-height: none;
  overflow: visible;
  padding-right: 0;
  padding-bottom: calc(var(--footer-safe-space) - 24px);
  align-content: start;
  min-width: 0;
  gap: 16px;
}

.workspace-layout {
  display: grid;
  grid-template-columns: 420px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  min-height: auto;
  min-width: 0;
  padding-bottom: var(--footer-safe-space);
}

.hierarchy-panel {
  position: sticky;
  top: 104px;
  padding: 18px;
  border: 1px solid rgba(99, 255, 214, 0.18);
  border-radius: 20px;
  background: rgba(2, 14, 12, 0.72);
  box-shadow: var(--shadow);
  min-height: 0;
  max-height: calc(100vh - 104px - var(--footer-safe-space));
  overflow-y: auto;
  overflow-x: hidden;
}

.hierarchy-head {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
}

.hierarchy-head span,
.hierarchy-empty {
  color: var(--muted);
  font-size: 13px;
}

.hierarchy-tree {
  display: grid;
  gap: 14px;
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

.hierarchy-campaign,
.hierarchy-adset {
  display: grid;
  gap: 8px;
}

.hierarchy-campaign-title {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  column-gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(99, 255, 214, 0.1);
  border: 1px solid rgba(99, 255, 214, 0.14);
  font-weight: 700;
}

.hierarchy-campaign.is-active .hierarchy-campaign-title {
  background: rgba(99, 255, 214, 0.18);
  border-color: rgba(99, 255, 214, 0.32);
  box-shadow:
    0 0 0 1px rgba(99, 255, 214, 0.14),
    0 0 22px rgba(10, 255, 185, 0.1);
}

.hierarchy-campaign-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hierarchy-budget {
  flex: 0 0 auto;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(99, 255, 214, 0.14);
  border: 1px solid rgba(99, 255, 214, 0.18);
  color: var(--text);
  font-size: 12px;
}

.hierarchy-adset {
  margin-left: 12px;
  padding-left: 12px;
  border-left: 1px solid rgba(99, 255, 214, 0.18);
}

.hierarchy-adset-title {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 8px;
  color: var(--text);
  opacity: 0.92;
  font-size: 13px;
}

.hierarchy-adset.is-active .hierarchy-adset-title {
  color: #e8fff9;
  text-shadow: 0 0 12px rgba(99, 255, 214, 0.12);
}

.hierarchy-adset-title span:last-of-type {
  flex: 1 1 auto;
  min-width: 0;
}

.hierarchy-icon {
  flex: 0 0 auto;
  display: inline-block;
}

.hierarchy-icon-campaign {
  width: 14px;
  height: 12px;
  border-radius: 3px;
  background: linear-gradient(180deg, #4ecbff, #2a82ff);
}

.hierarchy-icon-adset {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid rgba(99, 255, 214, 0.7);
  box-shadow:
    inset 4px 0 0 rgba(99, 255, 214, 0.2),
    inset -4px 0 0 rgba(99, 255, 214, 0.08);
}

.hierarchy-ad {
  flex: 1 1 auto;
  min-width: 0;
  justify-content: flex-start;
  text-align: left;
  padding: 11px 13px;
  border-radius: 14px;
  color: var(--text);
  background: rgba(99, 255, 214, 0.06);
  border: 1px solid rgba(99, 255, 214, 0.12);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hierarchy-ad.is-active {
  background: rgba(99, 255, 214, 0.16);
  border-color: rgba(99, 255, 214, 0.32);
  box-shadow: 0 0 0 1px rgba(99, 255, 214, 0.14);
}

.hierarchy-ad-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20px;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.hierarchy-remove {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid rgba(255, 107, 143, 0.3);
  background: rgba(255, 107, 143, 0.1);
  color: #ffc4d4;
  font-size: 14px;
  line-height: 1;
}

.hierarchy-remove:hover {
  background: rgba(255, 107, 143, 0.18);
  border-color: rgba(255, 107, 143, 0.44);
}

.hierarchy-remove-ad {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  font-size: 12px;
  border-radius: 7px;
}

.template-layout {
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  align-items: start;
}

.template-form,
.template-library {
  border: 1px solid rgba(99, 255, 214, 0.18);
  border-radius: 20px;
  background: rgba(2, 14, 12, 0.7);
  padding: 18px;
  min-width: 0;
}

.template-library {
  max-height: 640px;
  overflow: hidden;
}

.template-apply-bar {
  align-items: end;
}

.template-apply-bar label {
  flex: 1 1 auto;
}

.geo-link-grid {
  grid-template-columns: 1fr;
  margin-bottom: 14px;
}

.geo-presets {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.row-card {
  padding: 18px;
  scroll-margin-top: 156px;
}

.row-card.is-selected {
  border-color: rgba(99, 255, 214, 0.4);
  box-shadow: 0 0 0 1px rgba(99, 255, 214, 0.18), 0 16px 44px rgba(0, 0, 0, 0.38), 0 0 36px rgba(10, 255, 185, 0.08);
}

input.is-campaign-locked {
  opacity: 0.74;
  background: rgba(7, 18, 16, 0.82);
  border-style: dashed;
}

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
}

label {
  display: grid;
  gap: 8px;
  font-size: 13px;
}

label.wide {
  grid-column: 1 / -1;
}

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

input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(99, 255, 214, 0.2);
  border-radius: 16px;
  padding: 14px 15px;
  color: var(--text);
  background: rgba(2, 10, 9, 0.94);
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(10, 255, 185, 0.72);
  box-shadow: 0 0 0 4px rgba(10, 255, 185, 0.1);
  transform: translateY(-1px);
}

button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
}

.primary-button,
.upload-button,
.file-button {
  color: #03231d;
  background: linear-gradient(135deg, var(--accent-strong), #9bffe6);
  box-shadow: 0 12px 28px rgba(10, 255, 185, 0.25);
}

.file-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 10px 14px;
  border: 1px solid rgba(99, 255, 214, 0.2);
  border-radius: 18px;
  background: rgba(2, 10, 9, 0.94);
  overflow: hidden;
}

.file-picker input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.file-button,
.file-name {
  position: relative;
  z-index: 1;
}

.file-name {
  color: var(--text);
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ghost-button,
.remove-button {
  color: var(--text);
  background: rgba(99, 255, 214, 0.08);
  border: 1px solid rgba(99, 255, 214, 0.16);
}

.remove-button {
  color: #ffd4e0;
  background: rgba(255, 107, 143, 0.08);
  border-color: rgba(255, 107, 143, 0.18);
}

.creative-tools {
  align-items: end;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(99, 255, 214, 0.12);
  flex-wrap: wrap;
}

.creative-tools label {
  flex: 1 1 0;
  min-width: 220px;
}

.save-preset-button {
  align-self: stretch;
}

.footer-panel {
  position: sticky;
  bottom: 16px;
  z-index: 3;
  backdrop-filter: blur(14px);
  background: rgba(4, 18, 16, 0.92);
  border-color: rgba(99, 255, 214, 0.18);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.34), 0 0 26px rgba(10, 255, 185, 0.06);
}

.top-gap {
  margin-top: 16px;
}

.upload-fixed-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.upload-fixed-pill {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(99, 255, 214, 0.16);
  background: rgba(99, 255, 214, 0.08);
  color: var(--text);
}

.upload-results {
  display: grid;
  gap: 12px;
}

.admin-editor {
  display: grid;
  gap: 10px;
}

.admin-editor textarea {
  min-height: 320px;
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 12px;
  line-height: 1.45;
  resize: vertical;
}

.admin-table-wrap {
  overflow: auto;
  border: 1px solid rgba(99, 255, 214, 0.16);
  border-radius: 18px;
  background: rgba(2, 14, 12, 0.7);
  max-width: 100%;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 940px;
}

.admin-table th,
.admin-table td {
  padding: 12px;
  border-bottom: 1px solid rgba(99, 255, 214, 0.1);
  vertical-align: top;
}

.admin-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  color: var(--muted);
  background: rgba(4, 18, 15, 0.96);
}

.admin-table td input,
.admin-table td select,
.admin-table td textarea {
  min-width: 140px;
  padding: 10px 12px;
  border-radius: 12px;
}

.admin-table td textarea {
  min-height: 74px;
  resize: vertical;
}

.password-cell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: center;
  gap: 8px;
  min-width: 220px;
}

.password-toggle {
  min-width: 42px;
  width: 42px;
  height: 42px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 12px;
  line-height: 1;
}

.admin-table-empty {
  color: var(--muted);
  text-align: center;
}

.template-list {
  max-height: 520px;
  overflow-y: auto;
  padding-right: 6px;
}

.template-list::-webkit-scrollbar {
  width: 8px;
}

.template-list::-webkit-scrollbar-thumb {
  background: rgba(99, 255, 214, 0.28);
  border-radius: 999px;
}

.upload-result-card {
  padding: 14px 16px;
  border: 1px solid rgba(99, 255, 214, 0.18);
  border-radius: 18px;
  background: rgba(2, 14, 12, 0.7);
}

.template-card {
  padding: 11px 13px;
  border: 1px solid rgba(99, 255, 214, 0.18);
  border-radius: 16px;
  background: rgba(2, 14, 12, 0.7);
}

.template-card-meta,
.template-card-grid span {
  color: var(--muted);
  font-size: 12px;
}

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

.template-card-actions {
  margin-top: 10px;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
}

.template-card-actions button {
  padding: 8px 12px;
  font-size: 12px;
}

.upload-result-name {
  font-weight: 600;
  margin-bottom: 6px;
}

.upload-result-meta {
  color: var(--muted);
  margin-bottom: 8px;
}

.upload-result-meta.is-error {
  color: #ff9ab4;
}

.upload-result-hash {
  word-break: break-all;
  color: var(--text);
}

.upload-result-hash.is-success {
  color: var(--accent);
}

.empty-state {
  color: var(--muted);
}

.download-hint {
  margin-top: 12px;
  color: var(--muted);
}

.download-hint.is-error {
  color: #ff9ab4;
}

.download-hint.is-success {
  color: var(--accent);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}

@media (max-width: 860px) {
  .workspace-layout {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-bottom: 0;
  }

  .hierarchy-panel {
    position: static;
    max-height: none;
  }

  .rows {
    max-height: none;
    overflow: visible;
    padding-right: 0;
    padding-bottom: 0;
  }

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

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

  label.wide {
    grid-column: auto;
  }

  .creative-tools,
  .section-head,
  .row-topline,
  .actions,
  .template-apply-bar,
  .template-card-actions,
  .template-card-head {
    flex-direction: column;
    align-items: stretch;
  }

  .footer-panel {
    position: static;
  }

  .tab-nav {
    position: static;
    flex-direction: column;
  }

  .page {
    width: min(100%, calc(100% - 16px));
    padding-bottom: 28px;
  }
}
