:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-strong: #f8fafc;
  --text: #111827;
  --muted: #64748b;
  --border: #d7dee8;
  --accent: #155eef;
  --accent-strong: #0f3e99;
  --accent-soft: #edf4ff;
  --accent-ink: #ffffff;
  --warning: #a15c00;
  --danger: #b42318;
  --success: #047857;
  --gold: #7c6a35;
  --shadow: 0 14px 34px rgba(15, 23, 42, 0.07), 0 1px 2px rgba(15, 23, 42, 0.05);
  --control-shadow: 0 1px 2px rgba(15, 23, 42, 0.045);
  --button-shadow: 0 10px 20px rgba(21, 94, 239, 0.2), 0 1px 2px rgba(15, 23, 42, 0.12);
  --panel-gloss: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.92));
  --field-bg: #ffffff;
}

@media print {
  body,
  .app-shell,
  .app-main {
    background: #fff;
  }

  .topbar,
  .qr-print-toolbar,
  .ad-grid,
  .site-footer {
    display: none !important;
  }

  .app-main {
    padding: 0;
  }

  .qr-print-page {
    width: 100%;
    gap: 0;
  }

  .qr-print-sheet {
    break-after: page;
    border: 0;
    box-shadow: none;
  }

  .business-card,
  .package-label {
    width: 100%;
  }
}

html[data-theme="dark"] {
  --bg: #0b1118;
  --panel: #111827;
  --panel-strong: #172033;
  --text: #f3f6fb;
  --muted: #98a4b7;
  --border: #263345;
  --accent: #5b8cff;
  --accent-strong: #8eb0ff;
  --accent-soft: #172848;
  --accent-ink: #081120;
  --warning: #f0b45a;
  --danger: #ff8d86;
  --success: #69d7a0;
  --gold: #c7a85b;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.32), 0 1px 2px rgba(0, 0, 0, 0.24);
  --control-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
  --button-shadow: 0 12px 24px rgba(91, 140, 255, 0.18), 0 1px 2px rgba(0, 0, 0, 0.28);
  --panel-gloss: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.018));
  --field-bg: #0d141f;
}

html[data-theme="gray"] {
  --bg: #d9dde3;
  --panel: #f0f2f5;
  --panel-strong: #e6e9ee;
  --text: #1f2933;
  --muted: #5f6875;
  --border: #b7bec8;
  --accent: #46566a;
  --accent-strong: #2f3b4c;
  --accent-soft: #dde3ea;
  --accent-ink: #ffffff;
  --warning: #946200;
  --danger: #9f2a22;
  --success: #1f6b4a;
  --gold: #6f747d;
  --shadow: 0 14px 34px rgba(31, 41, 51, 0.13), 0 1px 2px rgba(31, 41, 51, 0.12);
  --control-shadow: 0 1px 2px rgba(31, 41, 51, 0.08);
  --button-shadow: 0 10px 20px rgba(70, 86, 106, 0.2), 0 1px 2px rgba(31, 41, 51, 0.14);
  --panel-gloss: linear-gradient(180deg, rgba(255, 255, 255, 0.48), rgba(240, 242, 245, 0.88));
  --field-bg: #f7f8fa;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  font-size: 16px;
  letter-spacing: 0;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--panel) 58%, transparent) 0, transparent 310px),
    linear-gradient(180deg, var(--bg), color-mix(in srgb, var(--bg) 84%, var(--panel-strong))),
    var(--bg);
  font-family: "Segoe UI", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--accent-strong);
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  width: min(1120px, calc(100% - 32px));
  min-height: 68px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 84%, transparent);
}

.brand-stack {
  display: grid;
  gap: 2px;
  justify-items: start;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
  font-size: 1.32rem;
  line-height: 1;
}

.brand-contact {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.2;
  transition: color 0.16s ease;
}

.brand-contact:hover {
  color: var(--accent-strong);
}

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

.support-link {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.16s ease;
}

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

.topbar-logout {
  display: inline-flex;
  margin: 0;
}

.support-link-button {
  padding: 0;
  border: 0;
  background: transparent;
}

.legal-button {
  height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  background: var(--panel-gloss), var(--panel);
  box-shadow: var(--control-shadow);
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}

a.legal-button {
  text-decoration: none;
}

.legal-button:hover {
  color: var(--accent-strong);
  border-color: color-mix(in srgb, var(--accent) 36%, var(--border));
  background: color-mix(in srgb, var(--accent-soft) 54%, var(--panel));
}

.legal-button-mark {
  width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--border));
  border-radius: 50%;
  color: var(--accent-strong);
  background: color-mix(in srgb, var(--accent-soft) 82%, var(--panel));
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
}

.auth-menu {
  position: relative;
  display: inline-flex;
}

.auth-menu::after {
  content: "";
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  height: 10px;
  z-index: 19;
}

.auth-menu-button {
  position: relative;
  z-index: 2;
}

.auth-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  min-width: 156px;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-gloss), var(--panel);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.auth-menu:hover .auth-menu-dropdown,
.auth-menu:focus-within .auth-menu-dropdown {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.auth-menu-item {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
}

.auth-menu-item:hover,
.auth-menu-item:focus-visible {
  color: var(--accent-strong);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
  background: color-mix(in srgb, var(--accent-soft) 70%, var(--panel));
  outline: none;
}

.language-switch select {
  height: 40px;
  padding: 0 30px 0 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  background: var(--panel-gloss), var(--panel);
  box-shadow: var(--control-shadow);
  font-weight: 600;
  outline: none;
}

.brand-core {
  color: var(--text);
}

.brand-tail {
  color: var(--accent);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel-gloss), var(--panel);
  box-shadow: var(--control-shadow);
}

.theme-button {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  color: var(--text);
  background: transparent;
}

.theme-button[aria-pressed="true"] {
  background: color-mix(in srgb, var(--accent-soft) 78%, var(--panel));
  box-shadow: inset 0 0 0 1px var(--border);
}

.theme-swatch {
  width: 16px;
  height: 16px;
  display: block;
  border-radius: 50%;
  border: 1px solid var(--border);
}

.theme-swatch-light {
  background:
    radial-gradient(circle at 70% 30%, #facc15 0 22%, transparent 23%),
    linear-gradient(135deg, #ffffff 0 58%, #eef6ff 58% 100%);
}

.theme-swatch-dark {
  background: linear-gradient(135deg, #101317 0 48%, #7bb2ff 48% 74%, #d6a94d 74% 100%);
}

.theme-swatch-gray {
  background: linear-gradient(135deg, #f1f2f4 0 46%, #a5abb3 46% 100%);
}

.app-main {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 26px 16px 56px;
}

.shortener-page {
  width: min(1120px, calc(100vw - 32px));
  max-width: 100%;
  margin-inline: auto;
  display: grid;
  justify-content: center;
  gap: 18px;
}

.shortener-page .ad-grid {
  order: 100;
}

.intro {
  max-width: 780px;
  margin: 0 auto 2px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
}

.intro h1 {
  margin: 0;
  color: var(--text);
  font-size: 2.5rem;
  line-height: 1.08;
  font-weight: 650;
}

.intro-copy {
  margin: 12px auto 0;
  max-width: 720px;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.58;
}

.tool-panel,
.result-panel,
.lookup-panel {
  justify-self: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-gloss), var(--panel);
  box-shadow: var(--shadow);
}

.tool-panel {
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 18px 20px 14px;
}

.result-panel,
.lookup-panel {
  width: 100%;
  padding: 20px;
}

.link-form {
  display: grid;
  gap: 12px;
}

.field-label,
.lookup-label {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.url-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  gap: 10px;
}

.url-field-group {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(108px, max-content) minmax(0, 1fr);
}

.url-field-group.is-protocol-hidden {
  grid-template-columns: minmax(0, 1fr);
}

.url-input,
.protocol-select,
.short-output input,
.date-field input,
.date-field textarea,
.date-field select,
.permanent-expiry-indicator {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: var(--field-bg);
  box-shadow: var(--control-shadow);
  outline: none;
}

.url-input,
.protocol-select,
.short-output input {
  height: 54px;
}

.url-input,
.short-output input {
  padding: 0 14px;
}

.protocol-select {
  max-width: 132px;
  padding: 0 42px 0 11px;
  border-right: 0;
  border-radius: 8px 0 0 8px;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position:
    calc(100% - 25px) 50%,
    calc(100% - 18px) 50%;
  background-repeat: no-repeat;
  background-size: 7px 7px;
  font-weight: 600;
}

.url-field-group .url-input {
  border-radius: 0 8px 8px 0;
}

.url-field-group.is-protocol-hidden .url-input {
  border-radius: 8px;
}

.url-input:focus,
.protocol-select:focus,
.short-output input:focus,
.date-field input:focus,
.date-field textarea:focus,
.date-field select:focus,
.language-switch select:focus,
.legal-button:focus-visible,
.theme-button:focus-visible,
.primary-action:focus-visible,
.icon-button:focus-visible,
.share-button:focus-visible,
.modal-close:focus-visible,
.legal-modal-action:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.url-input:focus,
.protocol-select:focus {
  position: relative;
  z-index: 1;
}

.primary-action {
  width: 54px;
  height: 54px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: var(--accent-ink);
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  box-shadow: var(--button-shadow);
  transition: box-shadow 0.16s ease, filter 0.16s ease, background 0.16s ease;
}

.primary-action:hover {
  filter: brightness(1.03);
}

.primary-action:disabled {
  cursor: wait;
  opacity: 0.72;
}

.icon-button svg,
.share-button svg {
  width: 24px;
  height: 24px;
  display: block;
  fill: currentColor;
}

.action-svg {
  width: 25px;
  height: 25px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.question-mark {
  display: none;
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1;
}

.primary-action[data-mode="lookup"] .icon-scissors {
  display: none;
}

.primary-action[data-mode="lookup"] .question-mark {
  display: block;
}

.options-row {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(160px, 1fr) max-content minmax(140px, 0.7fr) max-content max-content max-content max-content;
  align-items: end;
  gap: 12px;
}

.date-field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.date-field input {
  height: 42px;
  padding: 0 11px;
  color-scheme: light;
}

.expiration-switcher {
  display: grid;
  min-width: 0;
}

.expiration-switcher > * {
  grid-area: 1 / 1;
}

.permanent-expiry-indicator {
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0 12px;
  color: var(--accent-strong);
  background: color-mix(in srgb, var(--accent-soft) 72%, var(--field-bg));
}

.permanent-expiry-indicator span {
  font-size: 1.55rem;
  line-height: 1;
  font-weight: 500;
}

.date-field textarea {
  resize: vertical;
  padding: 10px 12px;
}

.date-field select {
  height: 42px;
  padding: 0 12px;
}

#expiresAtInput {
  text-align: center;
  text-align-last: center;
}

.limit-field input {
  appearance: textfield;
}

.limit-field input::-webkit-outer-spin-button,
.limit-field input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

.custom-code-field {
  width: min(380px, 100%);
}

.custom-domain-field {
  width: min(420px, 100%);
}

.password-field {
  width: min(380px, 100%);
}

.utm-builder,
.utm-fields {
  display: grid;
  gap: 12px;
}

.utm-fields {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel-strong) 70%, var(--panel));
}

.utm-fields h3 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
}

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

.utm-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

html[data-theme="dark"] .date-field input {
  color-scheme: dark;
}

.permanent-check {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  background: color-mix(in srgb, var(--panel-strong) 84%, var(--panel));
  box-shadow: var(--control-shadow);
  white-space: nowrap;
}

.permanent-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.message {
  min-height: 18px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.message.is-error {
  color: var(--danger);
}

.message.is-success {
  color: var(--success);
}

.ad-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 180px));
  justify-content: center;
  gap: 14px;
  margin-top: 4px;
}

.ad-slot {
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  border: 1px dashed color-mix(in srgb, var(--border) 78%, var(--muted));
  border-radius: 8px;
  color: var(--muted);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--panel) 72%, transparent), transparent),
    color-mix(in srgb, var(--panel-strong) 82%, var(--bg));
  box-shadow: var(--control-shadow);
}

.ad-slot span {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
}

@media (max-width: 900px) {
  .ad-grid {
    grid-template-columns: repeat(2, minmax(0, 180px));
  }
}

.result-meta {
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 10px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--border));
  border-radius: 999px;
  color: var(--accent-strong);
  background: color-mix(in srgb, var(--accent-soft) 70%, var(--panel));
  font-size: 0.82rem;
  font-weight: 600;
}

.short-output {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px;
  gap: 10px;
  margin-top: 8px;
}

.short-output input {
  font-weight: 600;
}

.icon-button {
  width: 52px;
  height: 54px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: color-mix(in srgb, var(--panel-strong) 86%, var(--panel));
  box-shadow: var(--control-shadow);
  transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.icon-button:hover {
  color: var(--accent-strong);
  border-color: color-mix(in srgb, var(--accent) 36%, var(--border));
  background: color-mix(in srgb, var(--accent-soft) 54%, var(--panel));
}

.share-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.share-button {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 7px;
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.16);
  transition: filter 0.16s ease, box-shadow 0.16s ease;
}

.share-native {
  background: #5b6472;
}

.share-whatsapp {
  background: #25d366;
}

.share-telegram {
  background: #229ed9;
}

.share-facebook {
  background: #1877f2;
}

.share-x {
  background: #111111;
}

.share-linkedin {
  background: #0a66c2;
}

.share-reddit {
  background: #ff4500;
}

.share-email {
  background: #7d3cb5;
}

.share-button:hover,
.share-qr:hover {
  filter: brightness(1.04);
}

.share-qr {
  padding: 4px;
  border: 1px solid var(--border);
  background: #ffffff;
  text-decoration: none;
}

.share-qr img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 4px;
}

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

.lookup-grid strong,
.lookup-grid a {
  display: block;
  min-width: 0;
  margin-top: 6px;
  color: var(--text);
  font-size: 0.98rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.lookup-url {
  grid-column: 1 / -1;
}

.deleted-link-page {
  width: min(560px, 100%);
  display: grid;
  gap: 12px;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-gloss), var(--panel);
  box-shadow: var(--shadow);
}

.deleted-link-page h1 {
  margin: 0;
  font-size: 1.55rem;
  line-height: 1.2;
}

.deleted-link-page p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.deleted-link-page a {
  justify-self: start;
  font-weight: 600;
  text-decoration: none;
}

.management-page {
  width: min(1120px, calc(100vw - 32px));
  max-width: 100%;
  margin-inline: auto;
  display: grid;
  justify-content: center;
  gap: 16px;
}

.auth-page {
  width: min(320px, calc(100vw - 32px));
  justify-content: center;
  justify-items: center;
  gap: 14px;
}

.auth-page .management-header {
  width: 100%;
  justify-self: center;
  display: grid;
  justify-items: center;
  text-align: center;
}

.auth-page .management-header h1,
.auth-page .management-header p {
  width: 100%;
  text-align: center;
}

.auth-panel {
  width: 100%;
  justify-self: center;
  padding: 16px;
}

.auth-panel .date-field {
  gap: 6px;
}

.auth-panel .date-field input {
  height: 34px;
  padding: 0 10px;
}

.auth-panel .legal-modal-action {
  min-height: 36px;
}

.management-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.management-header-row {
  align-items: center;
}

.management-header-actions {
  flex: 0 0 auto;
  flex-wrap: nowrap;
}

.management-header h1,
.management-panel h2 {
  margin: 0;
  font-weight: 600;
  line-height: 1.2;
}

.management-header h1 {
  font-size: 1.82rem;
}

.management-header p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.management-panel {
  width: 100%;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-gloss), var(--panel);
  box-shadow: var(--shadow);
}

.auth-page .management-header,
.auth-page .auth-panel {
  width: 100%;
  max-width: 100%;
  justify-self: center;
}

.account-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-gloss), var(--panel);
  box-shadow: var(--control-shadow);
  scrollbar-width: thin;
}

.account-tab {
  min-height: 34px;
  flex: 0 0 auto;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

.account-tab:hover,
.account-tab:focus-visible {
  color: var(--text);
  border-color: var(--border);
  outline: none;
}

.account-tab.is-active {
  color: var(--accent-ink);
  border-color: color-mix(in srgb, var(--accent) 72%, var(--border));
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #ffffff 16%, transparent);
}

.account-tab-panel {
  display: grid;
  gap: 18px;
}

.account-tab-panel[hidden] {
  display: none;
}

.management-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

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

.domain-management-grid {
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
}

.profile-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
}

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

.account-freeze-form {
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.danger-panel {
  border-color: color-mix(in srgb, var(--danger) 34%, var(--border));
}

.danger-action {
  border-color: color-mix(in srgb, var(--danger) 36%, var(--border));
  color: #ffffff;
  background: linear-gradient(180deg, color-mix(in srgb, var(--danger) 86%, #ffffff), var(--danger));
}

.stack-form {
  display: grid;
  gap: 12px;
}

.group-create-form,
.link-group-list,
.link-group-item,
.link-group-form {
  display: grid;
  gap: 10px;
}

.link-group-list {
  margin-top: 4px;
}

.link-group-item {
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.link-group-form {
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: end;
}

.link-group-form .date-field,
.link-group-form .group-count,
.link-group-form .compact-action {
  grid-column: 2;
}

.group-icon-preview {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--accent-strong);
  background: color-mix(in srgb, var(--accent-soft) 70%, var(--panel));
  font-weight: 600;
}

.group-count {
  color: var(--muted);
  font-size: 0.84rem;
}

.settings-group {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.settings-group legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
}

.stack-form .legal-modal-action,
.management-link-button {
  justify-self: start;
}

.management-link-button {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.metric-panel strong {
  display: block;
  margin-top: 5px;
  font-size: 1.62rem;
  font-weight: 600;
}

.admin-page {
  width: min(1280px, calc(100vw - 32px));
  justify-content: stretch;
  align-content: start;
}

.admin-page .management-header {
  align-items: center;
  padding-bottom: 2px;
}

.admin-page .management-header h1 {
  font-size: 1.72rem;
}

.admin-stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
}

.admin-stats-grid .metric-panel {
  min-height: 88px;
  display: grid;
  align-content: center;
  padding: 14px 16px;
}

.admin-forms-grid {
  grid-template-columns: minmax(240px, 0.62fr) minmax(0, 1.38fr);
  align-items: start;
}

.admin-forms-grid > .management-panel {
  align-self: start;
}

.admin-features-panel,
.admin-settings-panel {
  gap: 14px;
}

.admin-features-panel {
  position: sticky;
  top: 16px;
}

.admin-toggle-list {
  display: grid;
  gap: 8px;
}

.admin-settings-panel {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.admin-settings-panel > h2,
.admin-settings-panel > .legal-modal-action {
  grid-column: 1 / -1;
}

.admin-page .management-panel h2 {
  font-size: 1.18rem;
}

.admin-page .settings-group {
  min-width: 0;
  align-content: start;
  padding: 14px;
  background: color-mix(in srgb, var(--panel-strong) 78%, var(--panel));
}

.admin-page .settings-group legend {
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 600;
}

.admin-page .date-field {
  min-width: 0;
  gap: 6px;
}

.admin-page .date-field span {
  min-width: 0;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.admin-page .date-field input,
.admin-page .date-field textarea {
  min-height: 38px;
  padding: 0 10px;
  font-size: 0.9rem;
}

.admin-page .date-field textarea {
  min-height: 92px;
  padding: 10px;
}

.admin-page .permanent-check {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  justify-content: flex-start;
  white-space: normal;
}

.admin-page .permanent-check span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.admin-page .data-table-wrap {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: auto;
}

.admin-page .management-panel > h2 {
  margin-bottom: 12px;
}

.admin-page .data-table th,
.admin-page .data-table td {
  padding: 8px 10px;
}

.admin-api-token-panel {
  display: grid;
  gap: 14px;
}

.admin-token-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(180px, auto) auto;
  align-items: end;
  gap: 10px;
}

.admin-token-created {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--success) 36%, var(--border));
  border-radius: 8px;
  background: color-mix(in srgb, var(--success) 10%, var(--panel));
}

.admin-token-value {
  display: block;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  background: var(--field-bg);
  overflow-wrap: anywhere;
}

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

.admin-row-actions .inline-form {
  margin: 0;
}

.data-table-wrap {
  width: 100%;
  overflow-x: auto;
}

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

.links-table-wrap {
  overflow: visible;
}

.actions-table-wrap {
  overflow: visible;
}

.links-table {
  min-width: 0;
  table-layout: fixed;
}

.data-table th,
.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: var(--muted);
  background: color-mix(in srgb, var(--panel-strong) 90%, var(--panel));
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
}

.data-table tbody tr:hover {
  background: color-mix(in srgb, var(--accent-soft) 42%, transparent);
}

.links-table th,
.links-table td {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.links-table th:nth-child(1) {
  width: 11%;
}

.links-table th:nth-child(2) {
  width: 19%;
}

.links-table th:nth-child(3) {
  width: 13%;
}

.links-table th:nth-child(4),
.links-table th:nth-child(5) {
  width: 11%;
}

.links-table th:nth-child(6) {
  width: 11%;
}

.links-table th:nth-child(7) {
  width: 14%;
}

.links-table th:nth-child(8) {
  width: 9%;
}

.links-table .numeric-cell,
.links-table .date-cell {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

.links-table .date-cell {
  overflow: hidden;
  text-overflow: ellipsis;
}

.links-table .actions-cell {
  overflow: visible;
  text-align: center;
  white-space: nowrap;
}

.domain-table {
  min-width: 0;
  table-layout: fixed;
}

.domain-table th,
.domain-table td {
  overflow-wrap: anywhere;
}

.wide-cell {
  max-width: 420px;
  overflow-wrap: anywhere;
}

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

.mini-list li {
  display: grid;
  gap: 3px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

.mini-list strong,
.mini-list span,
.mini-list small,
.utm-tag-list span {
  overflow-wrap: anywhere;
}

.mini-list strong {
  font-weight: 600;
}

.mini-list span,
.mini-list small {
  color: var(--muted);
}

.utm-inline-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
  margin-top: 6px;
}

.utm-inline-form .compact-action {
  justify-self: start;
}

.utm-tag-list {
  display: grid;
  gap: 3px;
}

.shared-link-owner {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.table-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.links-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.links-panel-heading h1 {
  margin: 0;
}

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

.links-panel-actions .management-link-button {
  min-width: 116px;
  min-height: 42px;
  justify-content: center;
}

.links-table-toolbar {
  align-items: end;
}

.table-sort-form {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: auto;
}

.sort-control,
.assign-group-form {
  display: grid;
  gap: 6px;
}

.sort-control span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.sort-control select,
.assign-group-form select,
.group-create-form select,
.link-group-form select {
  min-height: 36px;
  width: 100%;
  padding: 0 34px 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: var(--field-bg);
  box-shadow: var(--control-shadow);
}

.group-create-inline {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 260px) auto;
  align-items: end;
  gap: 12px;
}

.groups-table {
  min-width: 720px;
}

.groups-table th:nth-child(1) {
  width: 68%;
}

.groups-table th:nth-child(2) {
  width: 18%;
}

.groups-table th:nth-child(3) {
  width: 14%;
}

.group-table-edit {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) minmax(160px, 240px) auto;
  align-items: end;
  gap: 10px;
}

.compact-field {
  min-width: 0;
}

.assign-group-form {
  margin-top: 8px;
}

.group-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.group-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--border));
  border-radius: 999px;
  color: var(--text);
  background: color-mix(in srgb, var(--accent-soft) 62%, var(--panel));
  font-size: 0.86rem;
  font-weight: 500;
}

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

.access-permission-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 14px;
}

.access-table {
  min-width: 860px;
}

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

.analytics-management-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.analytics-wide-panel {
  min-width: 0;
}

.analytics-share-url {
  margin-top: 14px;
}

.analytics-share-meta {
  margin-top: 12px;
}

.heatmap-wrap {
  width: 100%;
  margin-top: 14px;
  overflow-x: auto;
}

.heatmap-table {
  width: 100%;
  min-width: 820px;
  border-collapse: separate;
  border-spacing: 3px;
}

.heatmap-table th {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
}

.heatmap-table tbody th {
  width: 92px;
  padding-right: 8px;
  text-align: right;
}

.heatmap-cell {
  width: 28px;
  height: 24px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--panel-strong);
  text-align: center;
}

.heatmap-cell span {
  color: var(--muted);
  font-size: 0.68rem;
}

.heatmap-level-1 {
  background: color-mix(in srgb, var(--accent-soft) 72%, var(--panel));
}

.heatmap-level-2 {
  background: color-mix(in srgb, var(--accent-soft) 48%, var(--accent));
}

.heatmap-level-3 {
  background: color-mix(in srgb, var(--accent) 68%, var(--panel));
}

.heatmap-level-4 {
  background: color-mix(in srgb, var(--accent) 82%, var(--accent-strong));
}

.heatmap-level-5 {
  background: var(--accent-strong);
}

.heatmap-level-3 span,
.heatmap-level-4 span,
.heatmap-level-5 span {
  color: var(--accent-ink);
}

.bucket-list {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 14px 0 0;
  list-style: none;
}

.bucket-list li,
.feature-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.bucket-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.bucket-list strong {
  font-weight: 600;
}

.inline-form {
  display: inline-flex;
}

.row-actions-menu {
  position: relative;
  display: inline-flex;
}

.row-actions-button {
  min-width: 38px;
  min-height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  background: color-mix(in srgb, var(--panel-strong) 86%, var(--panel));
  box-shadow: var(--control-shadow);
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1;
}

.row-actions-dropdown {
  position: absolute;
  top: calc(100% - 1px);
  right: 0;
  z-index: 30;
  min-width: 154px;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.row-actions-menu:hover .row-actions-dropdown,
.row-actions-menu:focus-within .row-actions-dropdown,
.row-actions-menu.is-open .row-actions-dropdown {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.row-actions-item {
  min-height: 34px;
  width: 100%;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text);
  background: transparent;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.row-actions-item:hover,
.row-actions-item:focus-visible {
  color: var(--accent-strong);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
  background: color-mix(in srgb, var(--accent-soft) 70%, var(--panel));
  outline: none;
}

.row-actions-item.danger:hover,
.row-actions-item.danger:focus-visible {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 34%, var(--border));
}

.help-page {
  width: min(1080px, 100%);
}

.help-hero {
  display: grid;
  gap: 12px;
  padding: 28px;
  border-color: color-mix(in srgb, var(--accent) 24%, var(--border));
}

.help-kicker {
  width: max-content;
  padding: 5px 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
  border-radius: 999px;
  color: var(--accent-strong);
  background: color-mix(in srgb, var(--accent-soft) 76%, var(--panel));
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
}

.help-hero-copy {
  max-width: 820px;
  display: grid;
  gap: 10px;
}

.help-hero h1,
.help-hero p,
.help-lead,
.help-documentation h2,
.help-documentation p {
  margin: 0;
}

.help-hero h1 {
  font-size: 2.45rem;
  line-height: 1.08;
  font-weight: 600;
}

.help-hero p,
.help-lead,
.help-documentation p {
  color: var(--muted);
  line-height: 1.68;
  overflow-wrap: anywhere;
}

.help-documentation {
  display: grid;
  gap: 18px;
}

.help-lead {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-gloss), var(--panel);
  box-shadow: var(--control-shadow);
}

.help-beginner-roadmap {
  display: grid;
  gap: 18px;
  padding: 22px;
}

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

.help-beginner-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel-strong) 84%, var(--panel));
}

.help-beginner-card h3,
.help-beginner-note h3 {
  margin: 0 0 8px;
  font-size: 0.98rem;
  line-height: 1.28;
  font-weight: 600;
}

.help-beginner-note {
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border));
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent-soft) 62%, var(--panel));
}

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

.help-doc-card,
.help-guide-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 96%, var(--panel-strong));
  box-shadow: var(--control-shadow);
}

.help-playbook,
.help-faq {
  display: grid;
  gap: 14px;
}

.help-section-heading {
  display: grid;
  gap: 8px;
}

.help-section-heading h2,
.help-guide-card h3 {
  margin: 0;
  font-weight: 600;
  line-height: 1.28;
}

.help-section-heading h2 {
  font-size: 1.28rem;
}

.help-section-heading p,
.help-guide-card p,
.help-beginner-card p,
.help-beginner-note p,
.help-faq-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.68;
  overflow-wrap: anywhere;
}

.help-guide-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.help-guide-card {
  align-content: start;
}

.help-guide-card h3 {
  margin-bottom: 8px;
  font-size: 0.98rem;
}

.help-topic-link {
  color: var(--text);
  text-decoration: none;
}

.help-topic-link:hover,
.help-topic-link:focus-visible {
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 3px;
  outline: none;
}

.help-topic-read-more {
  width: max-content;
  display: inline-flex;
  margin-top: 12px;
  color: var(--accent-strong);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
}

.help-topic-read-more:hover,
.help-topic-read-more:focus-visible {
  text-decoration: underline;
  text-underline-offset: 3px;
  outline: none;
}

.help-topic-page {
  align-content: start;
}

.help-back-link {
  justify-self: start;
}

.help-topic-hero {
  gap: 14px;
}

.help-topic-article {
  display: grid;
  gap: 16px;
  max-width: 900px;
}

.help-topic-article p {
  margin: 0;
  color: var(--muted);
  line-height: 1.76;
  overflow-wrap: anywhere;
}

.help-topic-deep-dive {
  display: grid;
  gap: 18px;
}

.help-topic-deep-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.help-topic-deep-grid article {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel-strong) 76%, transparent);
}

.help-topic-deep-grid h3 {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.3;
  font-weight: 600;
}

.help-topic-deep-grid p,
.help-topic-checklist {
  margin: 0;
  color: var(--muted);
  line-height: 1.72;
  overflow-wrap: anywhere;
}

.help-topic-checklist {
  display: grid;
  gap: 8px;
  padding-left: 20px;
}

.help-faq-list {
  display: grid;
  gap: 10px;
}

.help-faq-item {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-gloss), var(--panel);
  box-shadow: var(--control-shadow);
}

.help-faq-item summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.help-faq-item summary::marker {
  color: var(--accent-strong);
}

.help-faq-item p {
  padding: 0 16px 16px 38px;
}

.help-section-number {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  border-radius: 8px;
  color: var(--accent-strong);
  background: color-mix(in srgb, var(--accent-soft) 72%, var(--panel));
  font-size: 0.78rem;
  font-weight: 600;
}

.help-documentation h2 {
  margin-bottom: 8px;
  font-size: 1.03rem;
  line-height: 1.28;
  font-weight: 600;
}

.inline-form button,
.compact-action {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  background: color-mix(in srgb, var(--panel-strong) 86%, var(--panel));
  box-shadow: var(--control-shadow);
  font-weight: 600;
}

.inline-form button:hover,
.compact-action:hover {
  color: var(--accent-strong);
  border-color: color-mix(in srgb, var(--accent) 34%, var(--border));
  background: color-mix(in srgb, var(--accent-soft) 48%, var(--panel));
}

.compact-action.danger {
  color: var(--danger);
}

.feature-row {
  flex-wrap: wrap;
  align-items: end;
  justify-content: flex-start;
  padding: 6px 0;
}

.feature-row > .permanent-check,
.feature-row > .compact-action,
.feature-row > .legal-modal-action {
  align-self: end;
}

.equal-action-row > .compact-action,
.equal-action-row > .legal-modal-action {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  width: 184px;
  max-width: 100%;
  justify-content: center;
  text-align: center;
}

.target-rule-edit-row[hidden] {
  display: none;
}

.target-rule-edit-row td {
  padding-top: 0;
}

.target-rule-edit-form {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border));
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel-strong) 78%, var(--panel));
}

.target-rule-edit-actions,
.history-rollback-form {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.history-rollback-form input {
  min-height: 36px;
  min-width: min(260px, 100%);
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: var(--field-bg);
}

.qr-product-panel {
  display: grid;
  grid-template-columns: minmax(320px, 440px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.qr-product-preview {
  display: grid;
  gap: 12px;
  align-self: start;
  position: sticky;
  top: 18px;
}

.qr-interactive-preview {
  width: min(100%, 380px);
  position: relative;
  display: block;
  justify-self: center;
  touch-action: none;
  user-select: none;
}

.qr-product-preview img {
  width: min(100%, 380px);
  height: auto;
  min-height: 320px;
  display: block;
  justify-self: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
}

.qr-interactive-preview img {
  width: 100%;
  pointer-events: none;
}

.qr-preview-edit-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.16s ease;
}

.qr-interactive-preview.is-preview-mode {
  cursor: pointer;
}

.qr-interactive-preview.is-preview-mode .qr-preview-edit-layer {
  opacity: 0;
  pointer-events: none;
}

.qr-preview-object {
  position: absolute;
  min-width: 28px;
  min-height: 24px;
  display: inline-grid;
  place-items: center;
  padding: 0 6px;
  border: 1px solid color-mix(in srgb, var(--accent) 72%, #ffffff);
  border-radius: 7px;
  color: #ffffff;
  background: color-mix(in srgb, var(--accent) 72%, rgba(17, 24, 39, 0.72));
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.16);
  cursor: move;
  pointer-events: auto;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1;
  text-align: center;
  overflow: visible;
}

.qr-preview-object-frame {
  border-style: dashed;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}

.qr-preview-object-logo {
  background: color-mix(in srgb, var(--text) 78%, var(--accent));
}

.qr-preview-object-text {
  min-height: 26px;
  border-style: dashed;
}

.qr-preview-object-custom {
  border-color: #38bdf8;
  background: rgba(14, 116, 144, 0.7);
}

.qr-preview-object-custom.is-selected {
  border-color: #ffffff;
  outline: 2px solid #0ea5e9;
}

.qr-preview-object-custom[data-qr-shape="circle"],
.qr-preview-object-custom[data-qr-shape="ellipse"] {
  border-radius: 999px;
}

.qr-preview-object-custom[data-qr-shape="triangle"],
.qr-preview-object-custom[data-qr-shape="diamond"],
.qr-preview-object-custom[data-qr-shape="hexagon"],
.qr-preview-object-custom[data-qr-shape="star"] {
  border-style: dotted;
}

.qr-preview-object span:first-child {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

.qr-preview-resize {
  position: absolute;
  right: -7px;
  bottom: -7px;
  width: 14px;
  height: 14px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.22);
  cursor: nwse-resize;
}

.qr-preview-object-text .qr-preview-resize {
  cursor: nwse-resize;
}

.qr-preview-rotate {
  position: absolute;
  left: 50%;
  top: -28px;
  width: 14px;
  height: 14px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: #0ea5e9;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.22);
  cursor: grab;
  transform: translateX(-50%);
}

.qr-preview-rotate::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 12px;
  width: 1px;
  height: 14px;
  background: #0ea5e9;
  transform: translateX(-50%);
}

.qr-product-actions,
.qr-style-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.qr-product-settings {
  display: grid;
  gap: 14px;
}

.qr-style-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
}

.qr-layout-groups {
  display: grid;
  gap: 12px;
}

.qr-block-toolbar,
.qr-block-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.qr-block-toolbar .date-field {
  min-width: min(220px, 100%);
  flex: 1 1 220px;
}

.qr-block-list:empty {
  display: none;
}

.qr-block-list-item {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: var(--field-bg);
  cursor: pointer;
}

.qr-block-list-item.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}

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

.qr-block-editor[hidden] {
  display: none;
}

.qr-layout-group {
  min-width: 0;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel-strong) 70%, var(--panel));
}

.qr-layout-group legend {
  padding: 0 6px;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
}

.qr-layout-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(90px, 1fr));
  gap: 10px;
}

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

.qr-style-grid input[type="color"] {
  min-height: 38px;
  padding: 4px;
}

.qr-print-page {
  width: min(980px, 100%);
  display: grid;
  gap: 18px;
}

.qr-print-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.qr-print-sheet {
  display: grid;
  gap: 14px;
  align-items: center;
  justify-items: center;
  padding: 28px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: #111827;
  background: #fff;
  page-break-inside: avoid;
}

.qr-print-sheet .qr-print-code {
  width: min(320px, 100%);
}

.qr-print-sheet svg {
  width: 100%;
  height: auto;
  display: block;
}

.qr-print-sheet p,
.qr-print-sheet h1,
.qr-print-sheet h2 {
  margin: 0;
  text-align: center;
}

.business-card {
  width: 420px;
  min-height: 240px;
  grid-template-columns: 1fr 150px;
  justify-items: stretch;
}

.business-card .qr-print-code {
  width: 150px;
}

.flyer {
  min-height: 640px;
}

.menu {
  min-height: 520px;
}

.package-label {
  width: 520px;
  grid-template-columns: 180px 1fr;
  justify-items: stretch;
}

.package-label .qr-print-code {
  width: 180px;
}

body.is-modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(12, 18, 30, 0.48);
  backdrop-filter: blur(3px);
}

.legal-modal {
  width: min(620px, 100%);
  max-height: min(720px, calc(100vh - 36px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28), var(--shadow);
  outline: none;
}

.legal-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.legal-modal-header h2 {
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.25;
}

.modal-close {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  background: color-mix(in srgb, var(--panel-strong) 86%, var(--panel));
  box-shadow: var(--control-shadow);
  font-size: 1.4rem;
  line-height: 1;
}

.modal-close:hover,
.legal-modal-action:hover {
  color: var(--accent-strong);
  border-color: color-mix(in srgb, var(--accent) 36%, var(--border));
}

.legal-modal-body {
  overflow: auto;
  padding: 18px 20px 6px;
}

.legal-modal-body p {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.58;
}

.legal-modal-body strong {
  color: var(--text);
}

.welcome-message-modal {
  max-width: min(640px, calc(100vw - 28px));
}

.welcome-message-modal .legal-modal-body p {
  color: var(--text);
  font-size: 1rem;
  line-height: 1.65;
}

.welcome-message-modal .legal-modal-actions {
  justify-content: space-between;
}

.legal-modal-actions {
  display: flex;
  justify-content: flex-end;
  padding: 14px 20px 20px;
}

.legal-modal-action {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  background: color-mix(in srgb, var(--panel-strong) 86%, var(--panel));
  box-shadow: var(--control-shadow);
  font-weight: 600;
}

@media (max-width: 700px) {
  .topbar {
    width: min(100% - 24px, 1120px);
    min-height: 64px;
    padding: 10px 0;
  }

  .topbar-actions {
    gap: 6px;
  }

  .support-link {
    display: none;
  }

  .language-switch select {
    height: 38px;
    padding: 0 24px 0 8px;
  }

  .legal-button {
    width: 38px;
    height: 38px;
    padding: 0;
    justify-content: center;
  }

  .legal-button-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .app-main {
    align-items: center;
    justify-content: flex-start;
    padding: 18px 12px 42px;
  }

  .intro {
    text-align: left;
  }

  .intro h1 {
    font-size: 2.2rem;
  }

  .intro-copy {
    font-size: 0.98rem;
  }

  .tool-panel,
  .result-panel,
  .lookup-panel {
    padding: 16px 16px 12px;
  }

  .url-row,
  .short-output {
    grid-template-columns: minmax(0, 1fr) 52px;
  }

  .url-input,
  .protocol-select,
  .primary-action,
  .short-output input,
  .icon-button {
    height: 52px;
  }

  .url-field-group {
    grid-template-columns: minmax(92px, max-content) minmax(0, 1fr);
  }

  .protocol-select {
    max-width: 124px;
    padding: 0 38px 0 10px;
    background-position:
      calc(100% - 23px) 50%,
      calc(100% - 16px) 50%;
  }

  .primary-action {
    width: 52px;
  }

  .options-row,
  .utm-grid,
  .ad-grid,
  .lookup-grid,
  .management-grid,
  .admin-settings-panel,
  .domain-management-grid,
  .stats-grid,
  .qr-product-panel,
  .qr-layout-grid,
  .qr-style-grid,
  .targeting-form-grid {
    grid-template-columns: 1fr;
  }

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

  .ad-slot {
    width: min(100%, 240px);
    justify-self: center;
  }

  .management-header {
    display: grid;
    align-items: start;
  }

  .management-header h1 {
    font-size: 1.6rem;
  }

  .table-toolbar {
    justify-content: stretch;
  }

  .links-table-toolbar > .management-link-button,
  .links-panel-actions,
  .table-sort-form {
    width: 100%;
  }

  .links-panel-heading,
  .links-panel-actions {
    justify-content: stretch;
  }

  .management-header-actions {
    flex-wrap: wrap;
  }

  .admin-features-panel {
    position: static;
  }

  .links-panel-actions .management-link-button {
    flex: 1 1 100%;
  }

  .table-sort-form {
    display: grid;
    justify-content: stretch;
    margin-left: 0;
  }

  .group-create-inline,
  .group-table-edit,
  .admin-token-form,
  .group-checkbox-list,
  .access-permission-grid {
    grid-template-columns: 1fr;
  }

  .help-hero {
    padding: 20px;
  }

  .help-doc-grid,
  .help-guide-grid,
  .help-beginner-grid,
  .help-topic-deep-grid,
  .help-doc-card {
    grid-template-columns: 1fr;
  }

  .help-guide-card,
  .help-beginner-card {
    grid-template-columns: 1fr;
  }

  .help-faq-item summary {
    padding: 12px 14px;
  }

  .help-faq-item p {
    padding: 0 14px 14px;
  }

  .qr-product-preview {
    position: static;
  }

  .qr-interactive-preview,
  .qr-product-preview img {
    width: min(100%, 340px);
    min-height: 260px;
  }

  .table-toolbar .sort-control,
  .table-toolbar .compact-action {
    width: 100%;
  }

  .permanent-check {
    justify-content: flex-start;
  }

  .legal-modal-header,
  .legal-modal-body,
  .legal-modal-actions {
    padding-left: 16px;
    padding-right: 16px;
  }

}

.auth-page {
  width: min(316px, calc(100vw - 48px));
  justify-content: center;
  justify-items: stretch;
}

.auth-page > .auth-header,
.auth-page > .auth-panel {
  width: 100%;
  justify-self: center;
}

.auth-page > .auth-header {
  display: block;
  text-align: center;
}

.auth-page > .auth-header h1,
.auth-page > .auth-header p {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}
