:root {
  --bg-app: #09090b;
  --bg-surface: #121215;
  --bg-subtle: #18181b;
  --bg-input: #121215;
  --bg-hover: #1f1f23;

  --border-default: #27272a;
  --border-subtle: #1e1e22;
  --border-focus: #52525b;

  --text-main: #f4f4f5;
  --text-muted: #a1a1aa;
  --text-dim: #71717a;

  --accent: #f4f4f5;
  --accent-emerald: #10b981;
  --accent-rose: #ef4444;
  --accent-amber: #f59e0b;

  /* Aliases kept for the admin panel */
  --primary: #f4f4f5;
  --cyan: #38bdf8;
  --emerald: #10b981;
  --rose: #ef4444;
  --amber: #f59e0b;
  --text-secondary: #a1a1aa;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;

  --radius-sm: 5px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--text-main);
}

code {
  font-family: var(--font-mono);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-focus);
}

/* ---------------------------------------------------------------- */
/* Header                                                            */
/* ---------------------------------------------------------------- */

.navbar {
  background: rgba(9, 9, 11, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 0.65rem 1.25rem;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.brand-icon {
  width: 26px;
  height: 26px;
  background: #ffffff;
  color: #09090b;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
}

.brand-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  border: 1px solid var(--border-default);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
}

.nav-tab:hover {
  color: var(--text-main);
  background: var(--bg-subtle);
}

.nav-tab.active {
  color: var(--text-main);
  background: var(--bg-subtle);
  border-color: var(--border-default);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#auth-logged-in {
  align-items: center;
  gap: 0.5rem;
}

.user-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
}

/* ---------------------------------------------------------------- */
/* Layout                                                            */
/* ---------------------------------------------------------------- */

.main-content {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 1.75rem 1.25rem;
}

.main-pad {
  padding-bottom: 1rem;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* ---------------------------------------------------------------- */
/* Pad banner                                                        */
/* ---------------------------------------------------------------- */

.pad-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.85rem;
  margin-bottom: 0.75rem;
}

.pad-banner-info,
.pad-banner-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------- */
/* Editor                                                            */
/* ---------------------------------------------------------------- */

.editor-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 190px);
  min-height: 460px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #0d0d10;
}

.editor-toolbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.toolbar-title {
  width: 200px;
  padding: 0.35rem 0.6rem;
  font-size: 0.82rem;
}

.toolbar-select {
  width: auto;
  padding: 0.35rem 0.5rem;
  font-size: 0.8rem;
}

.toolbar-check {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.toolbar-check input {
  accent-color: #ef4444;
}

.editor-workspace {
  flex: 1;
  display: flex;
  min-height: 0;
  position: relative;
}

.line-numbers {
  width: 50px;
  flex-shrink: 0;
  background: #09090b;
  border-right: 1px solid var(--border-default);
  padding: 1rem 0.5rem 1rem 0;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--text-dim);
  text-align: right;
  user-select: none;
  overflow: hidden;
  line-height: 1.6;
  white-space: pre;
}

.code-layer {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.highlight-layer,
.code-textarea {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
  white-space: pre;
  tab-size: 2;
  border: 0;
  overflow: auto;
}

.highlight-layer {
  z-index: 0;
  color: var(--text-main);
  pointer-events: none;
  overflow: hidden;
}

.highlight-layer code {
  font: inherit;
  background: none !important;
  text-shadow: none !important;
  padding: 0 !important;
  white-space: inherit;
}

.code-textarea {
  z-index: 1;
  background: transparent;
  color: transparent;
  caret-color: #ffffff;
  resize: none;
  outline: none;
}

.code-textarea::placeholder {
  color: #52525b;
  opacity: 1;
}

.code-textarea::selection {
  background: rgba(99, 102, 241, 0.35);
}

.highlight-layer.is-plain code {
  color: var(--text-main);
}

.editor-statusbar {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-default);
  padding: 0.35rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* ---------------------------------------------------------------- */
/* Hero + shortener                                                  */
/* ---------------------------------------------------------------- */

.hero {
  text-align: center;
  margin: 1rem 0 2rem;
}

.hero-title {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
  color: #ffffff;
}

.hero-subtitle {
  color: var(--text-muted);
  font-size: 0.92rem;
  max-width: 560px;
  margin: 0 auto;
}

.form-card {
  max-width: 680px;
  margin: 0 auto;
}

.card,
.glass-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 1.6rem;
}

/* ---------------------------------------------------------------- */
/* Forms                                                             */
/* ---------------------------------------------------------------- */

.form-group {
  margin-bottom: 1.1rem;
}

.form-group-submit {
  display: flex;
  align-items: flex-end;
}

.form-group-submit .btn {
  width: 100%;
  height: 38px;
}

.form-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.form-label-hint {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: none;
  letter-spacing: 0;
}

.form-input,
.form-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  color: var(--text-main);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 1px var(--border-focus);
}

.form-input:disabled,
.form-select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.input-with-prefix {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  overflow: hidden;
}

.input-with-prefix span {
  display: flex;
  align-items: center;
  padding: 0 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  background: var(--bg-subtle);
  border-right: 1px solid var(--border-default);
}

.input-with-prefix .form-input {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.input-with-prefix .form-input:focus {
  box-shadow: none;
}

.form-error {
  color: #f87171;
  font-size: 0.8rem;
  margin-bottom: 0.9rem;
  line-height: 1.5;
}

/* ---------------------------------------------------------------- */
/* Buttons                                                           */
/* ---------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
  text-decoration: none;
  line-height: 1;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: #ffffff;
  color: #09090b;
}

.btn-primary:hover:not(:disabled) {
  background: #e4e4e7;
}

.btn-secondary {
  background: var(--bg-subtle);
  color: var(--text-main);
  border-color: var(--border-default);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-focus);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.25);
}

.btn-danger:hover:not(:disabled) {
  background: #ef4444;
  color: #ffffff;
}

.btn-sm {
  padding: 0.38rem 0.7rem;
  font-size: 0.78rem;
}

.btn-block {
  width: 100%;
}

.link-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

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

.resend-btn {
  display: block;
  margin: 0.9rem auto 0;
  font-size: 0.78rem;
}

/* ---------------------------------------------------------------- */
/* Redirect mode selector                                            */
/* ---------------------------------------------------------------- */

.mode-selector {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
}

.mode-option {
  border: 1px solid var(--border-default);
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  cursor: pointer;
  display: flex;
  gap: 0.55rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.mode-option:hover {
  border-color: var(--border-focus);
}

.mode-option.active {
  border-color: #ffffff;
  background: #18181b;
}

.mode-option input {
  margin-top: 3px;
  accent-color: #ffffff;
}

.mode-option-title {
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.mode-option-desc {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ---------------------------------------------------------------- */
/* Result box                                                        */
/* ---------------------------------------------------------------- */

.result-box {
  margin-top: 1.5rem;
  border-top: 1px solid var(--border-default);
  padding-top: 1.25rem;
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.85rem;
}

.result-url {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: #ffffff;
  word-break: break-all;
  text-decoration: none;
}

.result-url:hover {
  text-decoration: underline;
}

.result-actions {
  display: flex;
  gap: 0.35rem;
}

.result-target {
  margin-top: 0.7rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  word-break: break-all;
}

.result-qr {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-top: 1rem;
}

.result-qr img {
  background: #ffffff;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: block;
}

.result-qr-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.result-qr-text strong {
  color: var(--text-main);
}

/* ---------------------------------------------------------------- */
/* Captcha                                                           */
/* ---------------------------------------------------------------- */

.captcha-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.captcha-img {
  display: block;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.captcha-row .form-input {
  font-family: var(--font-mono);
  font-weight: 600;
}

/* ---------------------------------------------------------------- */
/* Badges                                                            */
/* ---------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--font-mono);
  line-height: 1.2;
}

.badge-neutral {
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-default);
}

.badge-emerald {
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-rose {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.badge-amber {
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.badge-cyan {
  background: rgba(56, 189, 248, 0.1);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

/* ---------------------------------------------------------------- */
/* Modals                                                            */
/* ---------------------------------------------------------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1.25rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 700;
}

.modal-body {
  padding: 1.25rem;
}

.modal-note {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.modal-note.small {
  font-size: 0.76rem;
  margin-top: 0.6rem;
  margin-bottom: 0;
  text-align: center;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.close-btn:hover {
  color: #ffffff;
}

.segmented {
  display: flex;
  gap: 0.3rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 0.2rem;
  margin-bottom: 1.25rem;
}

.segmented-btn {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.45rem;
  border-radius: 4px;
  cursor: pointer;
}

.segmented-btn.active {
  background: var(--bg-app);
  color: var(--text-main);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.code-input {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  letter-spacing: 0.4em;
  text-align: center;
}

.copy-row {
  display: flex;
  gap: 0.4rem;
}

.copy-row .form-input {
  flex: 1;
}

.share-badges {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.9rem;
}

/* ---------------------------------------------------------------- */
/* Toasts                                                            */
/* ---------------------------------------------------------------- */

.toast-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 200;
  max-width: min(360px, calc(100vw - 2.5rem));
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-left: 3px solid var(--text-dim);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  font-size: 0.82rem;
  color: var(--text-main);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.15s ease;
}

.toast-success {
  border-left-color: var(--accent-emerald);
}

.toast-error {
  border-left-color: var(--accent-rose);
}

.toast-out {
  opacity: 0;
  transition: opacity 0.2s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------------------------------------------------------------- */
/* Footer                                                            */
/* ---------------------------------------------------------------- */

.footer {
  margin-top: auto;
  border-top: 1px solid var(--border-subtle);
  padding: 1.1rem 1.25rem;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.footer-links {
  display: flex;
  gap: 1rem;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--text-main);
  text-decoration: underline;
}

/* ---------------------------------------------------------------- */
/* Grids                                                             */
/* ---------------------------------------------------------------- */

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

/* ---------------------------------------------------------------- */
/* Admin panel                                                       */
/* ---------------------------------------------------------------- */

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
}

.stat-header {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}

.stat-footer {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 0.35rem;
}

.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.84rem;
}

.data-table th {
  background: var(--bg-subtle);
  padding: 0.7rem 0.9rem;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-default);
  white-space: nowrap;
}

.data-table td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
  vertical-align: middle;
}

.data-table tr:hover {
  background: var(--bg-hover);
}

.admin-nav-btn.active {
  background: #ffffff;
  color: #09090b;
  border-color: #ffffff;
}

/* ---------------------------------------------------------------- */
/* Legal pages                                                       */
/* ---------------------------------------------------------------- */

.legal {
  max-width: 780px;
  margin: 0 auto;
}

.legal h1 {
  font-size: 1.8rem;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.legal .legal-meta {
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-bottom: 1.75rem;
}

.legal h2 {
  font-size: 1.05rem;
  margin: 1.6rem 0 0.5rem;
}

.legal p,
.legal li {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.7;
}

.legal ul {
  padding-left: 1.2rem;
  margin: 0.35rem 0 0.75rem;
}

.legal a {
  color: #ffffff;
}

.legal-nav {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
}

/* ---------------------------------------------------------------- */
/* Responsive                                                        */
/* ---------------------------------------------------------------- */

@media (max-width: 820px) {
  .grid-2,
  .grid-3,
  .mode-selector {
    grid-template-columns: 1fr;
  }

  .nav-container {
    flex-wrap: wrap;
  }

  .nav-tabs {
    order: 3;
    width: 100%;
  }

  .editor-container {
    height: calc(100vh - 250px);
  }

  .toolbar-title {
    width: 150px;
  }

  .hero-title {
    font-size: 1.55rem;
  }
}

@media (max-width: 520px) {
  .main-content {
    padding: 1rem 0.75rem;
  }

  .editor-statusbar span:last-child {
    display: none;
  }

  .user-badge {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* ------------------------------------------------------------------ */
/* Link owner dashboard                                                */
/* ------------------------------------------------------------------ */

.my-links-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.link-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: var(--bg-surface, #121215);
  border: 1px solid var(--border-subtle, #27272a);
  border-radius: var(--radius-md, 8px);
  cursor: pointer;
  text-align: left;
  width: 100%;
  color: inherit;
  font: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.link-row:hover {
  border-color: var(--primary, #6366f1);
  transform: translateY(-1px);
}

.link-row-main {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.link-row-slug {
  font-family: var(--font-mono, monospace);
  font-weight: 700;
  color: var(--cyan, #06b6d4);
}

.link-row-target {
  font-size: 0.8rem;
  color: var(--text-muted, #71717a);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 340px;
}

.link-row-stats {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  font-size: 0.8rem;
  color: var(--text-secondary, #a1a1aa);
  white-space: nowrap;
}

.link-row-stats strong {
  color: var(--text-primary, #f4f4f5);
  font-family: var(--font-mono, monospace);
}

.empty-note {
  padding: 1.25rem;
  text-align: center;
  color: var(--text-muted, #71717a);
  font-size: 0.875rem;
}

.link-detail-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-subtle, #27272a);
}

.sub-card {
  background: var(--bg-surface, #121215);
  border: 1px solid var(--border-subtle, #27272a);
  border-radius: var(--radius-md, 8px);
  padding: 1.1rem;
}

.sub-card-title {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.85rem;
}

.sub-card-note {
  font-size: 0.78rem;
  color: var(--text-muted, #71717a);
  margin-bottom: 0.85rem;
}

.stat-mini {
  background: var(--bg-surface, #121215);
  border: 1px solid var(--border-subtle, #27272a);
  border-radius: var(--radius-md, 8px);
  padding: 0.9rem 1rem;
}

.stat-mini-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted, #71717a);
  margin-bottom: 0.3rem;
}

.stat-mini-value {
  font-size: 1.35rem;
  font-weight: 800;
  font-family: var(--font-mono, monospace);
  color: var(--text-primary, #f4f4f5);
}

.bar-row {
  margin-bottom: 0.7rem;
}

.bar-top {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  margin-bottom: 0.3rem;
}

.bar-track {
  height: 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--primary, #6366f1), var(--cyan, #06b6d4));
}

.mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.mini-table th,
.mini-table td {
  text-align: left;
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  white-space: nowrap;
}

.mini-table th {
  color: var(--text-muted, #71717a);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mini-table td {
  font-family: var(--font-mono, monospace);
  color: var(--text-secondary, #a1a1aa);
}

.daily-bars {
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
  height: 110px;
}

.daily-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 0.3rem;
  height: 100%;
}

.daily-bar-fill {
  width: 100%;
  background: linear-gradient(180deg, var(--cyan, #06b6d4), var(--primary, #6366f1));
  border-radius: 3px 3px 0 0;
  min-height: 3px;
}

.daily-bar-label {
  font-size: 0.62rem;
  color: var(--text-muted, #71717a);
  font-family: var(--font-mono, monospace);
}

/* ------------------------------------------------------------------ */
/* Pad history                                                         */
/* ------------------------------------------------------------------ */

.modal-wide {
  max-width: 760px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 60vh;
  overflow-y: auto;
}

.history-item {
  background: var(--bg-surface, #121215);
  border: 1px solid var(--border-subtle, #27272a);
  border-radius: var(--radius-md, 8px);
  padding: 0.85rem 1rem;
}

.history-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.history-time {
  font-size: 0.85rem;
  font-weight: 600;
}

.history-sub {
  font-size: 0.75rem;
  color: var(--text-muted, #71717a);
  font-family: var(--font-mono, monospace);
}

.history-preview {
  margin-top: 0.65rem;
  padding: 0.65rem 0.75rem;
  background: #0a0a0c;
  border: 1px solid var(--border-subtle, #27272a);
  border-radius: 6px;
  font-family: var(--font-mono, monospace);
  font-size: 0.78rem;
  color: var(--text-secondary, #a1a1aa);
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ------------------------------------------------------------------ */
/* Pad access codes & share limits                                     */
/* ------------------------------------------------------------------ */

.toolbar-code {
  width: 120px;
  font-family: var(--font-mono, monospace);
}

.toolbar-label {
  font-size: 0.75rem;
  color: var(--text-muted, #71717a);
  white-space: nowrap;
}

.share-callout {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.08);
  border-radius: var(--radius-md, 8px);
  font-size: 0.82rem;
  color: var(--text-secondary, #a1a1aa);
  line-height: 1.55;
}

.share-callout strong {
  color: var(--amber, #f59e0b);
}

.auth-forgot {
  display: block;
  margin: -0.35rem 0 1rem auto;
  font-size: 0.8rem;
}

#code-gate .modal-dialog {
  border-color: rgba(245, 158, 11, 0.35);
}

/* ------------------------------------------------------------------ */
/* Account page                                                        */
/* ------------------------------------------------------------------ */

.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
  align-items: start;
}

.account-card {
  background: var(--bg-surface, #121215);
  border: 1px solid var(--border-subtle, #27272a);
  border-radius: var(--radius-lg, 12px);
  padding: 1.4rem;
}

.account-card h2 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.account-field {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.86rem;
}

.account-field span:first-child {
  color: var(--text-muted, #71717a);
}

.account-field span:last-child {
  font-family: var(--font-mono, monospace);
  color: var(--text-secondary, #a1a1aa);
  text-align: right;
  word-break: break-word;
}

.account-session {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.82rem;
}

.account-session:last-child {
  border-bottom: none;
}

.account-session-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  color: var(--text-muted, #71717a);
  font-family: var(--font-mono, monospace);
  font-size: 0.75rem;
}

.danger-zone {
  border-color: rgba(244, 63, 94, 0.35);
}

.danger-zone h2 {
  color: var(--rose, #f43f5e);
}

.account-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

/* ------------------------------------------------------------------ */
/* Admin: users & audit trail                                          */
/* ------------------------------------------------------------------ */

.admin-search-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.admin-search-row .form-input {
  max-width: 420px;
}

.audit-action {
  font-family: var(--font-mono, monospace);
  font-size: 0.78rem;
  color: var(--cyan, #06b6d4);
}

.audit-meta {
  display: block;
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
  color: var(--text-muted, #71717a);
}

.dossier-section {
  background: var(--bg-surface, #121215);
  border: 1px solid var(--border-subtle, #27272a);
  border-radius: var(--radius-md, 8px);
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
}

.dossier-section h4 {
  color: var(--cyan, #06b6d4);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.65rem;
}

.dossier-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-family: var(--font-mono, monospace);
  font-size: 0.78rem;
  color: var(--text-secondary, #a1a1aa);
}

.share-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border, rgba(255,255,255,0.08));
}

.share-presets-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted, #94a3b8);
  margin-right: 0.25rem;
}

.share-qr {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  padding: 0.9rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 12px;
}

.share-qr img {
  background: #fff;
  border-radius: 8px;
  padding: 4px;
  flex-shrink: 0;
}

.share-qr-text {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.82rem;
  color: var(--text-secondary, #a1a1aa);
  min-width: 0;
}

.share-qr-text strong {
  color: var(--text-primary, #f8fafc);
}

.share-qr-text .btn {
  align-self: flex-start;
  margin-top: 0.35rem;
}

@media (max-width: 620px) {
  .account-kpis {
    grid-template-columns: 1fr;
  }

  .share-qr {
    align-items: flex-start;
  }

  .toolbar-code {
    width: 100%;
  }
}
