:root {
  --bg: #f6fafb;
  --surface: #ffffff;
  --surface-soft: #f1f7f8;
  --text: #172033;
  --muted: #64748b;
  --line: #dbe6ea;
  --primary: #6d5dfc;
  --primary-2: #cf3fa8;
  --accent: #0ea5a3;
  --green: #10b981;
  --danger: #ef4444;
  --orange: #f97316;
  --shadow: 0 18px 42px rgba(20, 35, 55, 0.09);
  --shadow-small: 0 8px 22px rgba(20, 35, 55, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(14, 165, 163, 0.05), transparent 240px),
    var(--bg);
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.hidden {
  display: none !important;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(320px, 45vw) 1fr;
  min-height: 100vh;
  background: var(--surface);
}

.auth-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 34px;
  padding: 48px;
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(14, 165, 163, 0.9), rgba(109, 93, 252, 0.92) 56%, rgba(207, 63, 168, 0.9)),
    #6857eb;
}

.auth-panel h1 {
  max-width: 600px;
  margin: 0 0 14px;
  font-size: 34px;
  line-height: 1.15;
}

.auth-panel p,
.auth-points {
  color: rgba(255, 255, 255, 0.86);
}

.auth-points {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-weight: 700;
}

.auth-points li::before {
  content: "check";
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-right: 10px;
  border-radius: 50%;
  color: #0f766e;
  background: rgba(255, 255, 255, 0.85);
  font-size: 9px;
  vertical-align: 2px;
}

.brand-mark,
.mini-brand,
.brand-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.brand-icon {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  border-radius: 7px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  font-size: 10px;
  text-transform: uppercase;
}

.auth-form-wrap {
  display: grid;
  place-items: center;
  padding: 30px;
}

.auth-card {
  width: min(440px, 100%);
}

.auth-card h2 {
  margin: 28px 0 6px;
  font-size: 30px;
}

.muted,
.small-muted,
label small,
.dashboard-header p,
.page-header p {
  color: var(--muted);
}

.small-muted {
  margin-top: 18px;
  text-align: center;
  font-size: 13px;
}

label {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  font-weight: 750;
}

label span,
.label-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

label b {
  color: var(--danger);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  color: var(--text);
  background: #ffffff;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(109, 93, 252, 0.13);
}

textarea {
  resize: vertical;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 800;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none;
}

.btn-primary,
.btn-create {
  color: #ffffff;
  background: linear-gradient(135deg, #269ee5, var(--primary) 48%, var(--primary-2));
  box-shadow: 0 9px 22px rgba(109, 93, 252, 0.28);
}

.btn-secondary {
  border: 1px solid var(--line);
  color: #334155;
  background: #ffffff;
}

.btn-danger {
  color: #ffffff;
  background: var(--danger);
}

.btn-open {
  color: #ffffff;
  background: #0ea5e9;
}

.btn-edit {
  color: #ffffff;
  background: var(--orange);
}

.wide {
  width: 100%;
}

.form-error {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--danger);
  font-weight: 750;
}

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

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1120px, calc(100% - 32px));
  height: 72px;
  margin: 0 auto;
}

.brand-button,
.nav-links button {
  border: 0;
  background: transparent;
}

.brand-button {
  color: var(--primary);
  font-size: 20px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-links button {
  border-radius: 8px;
  padding: 9px 12px;
  color: #334155;
  font-weight: 750;
}

.nav-links button.active,
.nav-links button:hover {
  background: var(--surface-soft);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

#nav-username {
  color: var(--primary);
  font-weight: 850;
}

.main-content {
  min-height: calc(100vh - 143px);
  padding: 34px 16px 54px;
}

.page-narrow {
  width: min(680px, 100%);
  margin: 0 auto;
}

.page-wide {
  width: min(1120px, 100%);
  margin: 0 auto;
}

.page-header,
.dashboard-header {
  margin-bottom: 24px;
}

.page-header {
  text-align: center;
}

.page-header h1,
.dashboard-header h1 {
  margin: 0 0 8px;
  font-size: 32px;
  line-height: 1.16;
}

.page-header h1 span,
.dashboard-header h1 {
  color: var(--primary);
}

.page-header h1 span {
  background: linear-gradient(135deg, var(--primary), var(--primary-2), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.shorten-card,
.toolbar-card,
.table-card,
.edit-card,
.success-card,
.bulk-bar {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-small);
}

.shorten-card {
  overflow: hidden;
  border-top: 3px solid var(--primary);
  padding: 22px;
}

.tab-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.type-tab {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #475569;
  background: #ffffff;
  font-weight: 850;
}

.type-tab.active {
  border-color: transparent;
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 8px 18px rgba(109, 93, 252, 0.25);
}

.form-stack {
  margin-top: 18px;
}

.field-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #ffffff;
}

.social-fields {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.label-row {
  justify-content: space-between;
  margin-bottom: 10px;
  font-weight: 850;
}

.upload-zone {
  display: grid;
  place-items: center;
  min-height: 190px;
  border: 1px dashed #aab8c5;
  border-radius: 8px;
  padding: 18px;
  text-align: center;
  background: #f9fcfc;
}

.upload-zone.dragging {
  border-color: var(--primary);
  background: rgba(109, 93, 252, 0.06);
}

#upload-placeholder {
  display: grid;
  gap: 8px;
  justify-items: center;
  color: var(--muted);
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 8px;
  color: var(--primary);
  background: rgba(109, 93, 252, 0.12);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.image-preview {
  display: grid;
  gap: 8px;
  justify-items: center;
}

.image-preview img {
  max-width: 260px;
  max-height: 180px;
  border: 2px solid var(--primary);
  border-radius: 8px;
  object-fit: cover;
}

.progress-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
  margin-top: 18px;
}

.progress-line {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
}

.progress-line span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--primary), var(--primary-2));
  transition: width 0.2s ease;
}

#progress-msg {
  grid-column: 1 / -1;
}

.success-card {
  display: grid;
  gap: 14px;
  margin-bottom: 22px;
  padding: 18px;
}

.success-head {
  display: flex;
  gap: 12px;
  align-items: center;
}

.success-head span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #ffffff;
  background: var(--green);
  font-weight: 900;
}

.short-url-box {
  padding: 12px;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--primary);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.success-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 26px;
}

.feature-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-small);
}

.feature-grid h3 {
  margin: 12px 0 6px;
}

.feature-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.feature-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  color: #ffffff;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.feature-icon.purple {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
}

.feature-icon.green {
  background: linear-gradient(135deg, var(--green), var(--accent));
}

.feature-icon.blue {
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
}

.toolbar-card {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.bulk-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  padding: 12px 14px;
}

.table-card {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

th,
td {
  padding: 16px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: #64748b;
  background: #f7fbfb;
  font-size: 12px;
  text-transform: uppercase;
}

td a {
  color: var(--primary);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.target-cell {
  max-width: 380px;
  color: #475569;
  overflow-wrap: anywhere;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  color: #0f766e;
  background: rgba(14, 165, 163, 0.12);
  font-size: 12px;
  font-weight: 850;
  text-transform: capitalize;
}

.empty-state {
  padding: 36px;
  text-align: center;
  color: var(--muted);
}

.edit-page {
  width: min(660px, 100%);
  margin: 0 auto;
}

.edit-card {
  display: grid;
  gap: 18px;
  padding: 22px;
  border-top: 3px solid var(--primary);
}

.edit-card label {
  margin-top: 0;
}

.edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 70px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: #ffffff;
}

.preview-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
}

.redirect-preview {
  width: min(560px, calc(100% - 32px));
}

.preview-card {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.preview-image {
  width: 100%;
  max-height: 300px;
  border-radius: 8px;
  object-fit: cover;
}

.eyebrow {
  margin: 0;
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

@media (max-width: 820px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-panel {
    min-height: 310px;
    padding: 34px 22px;
  }

  .nav-inner {
    height: auto;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 0;
  }

  .nav-user {
    width: 100%;
    justify-content: space-between;
  }

  .page-header h1,
  .dashboard-header h1 {
    font-size: 28px;
  }

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

@media (max-width: 560px) {
  .main-content {
    padding-inline: 10px;
  }

  .shorten-card,
  .edit-card {
    padding: 16px;
  }

  .tab-row {
    grid-template-columns: 1fr;
  }

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

  .nav-links button {
    flex: 1;
  }

  .success-actions,
  .bulk-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .footer {
    flex-wrap: wrap;
    padding: 14px;
    text-align: center;
  }
}
