html {
  scroll-behavior: smooth;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

[hidden] {
  display: none !important;
}

[data-theme="lin"] {
  --color-base-100: #ffffff;
  --color-base-200: #f6f8fb;
  --color-base-300: #dde3ea;
  --color-base-content: #172033;
  --color-primary: #2563eb;
  --color-primary-content: #ffffff;
  --color-secondary: #0ea5e9;
  --color-secondary-content: #ffffff;
  --color-neutral: #111827;
  --color-neutral-content: #ffffff;
  --color-success: #16a34a;
  --color-success-content: #ffffff;
  --color-error: #dc2626;
  --color-error-content: #ffffff;
  --color-info: #2563eb;
  --color-info-content: #ffffff;
  --rounded-box: 0.75rem;
  --rounded-btn: 0.5rem;
  --rounded-field: 0.5rem;
}

.app-shell {
  width: 100%;
  max-width: 100%;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 1.25rem;
}

.dashboard-shell {
  display: grid;
  width: 100%;
  max-width: 100%;
  min-height: 100dvh;
  grid-template-rows: auto auto auto;
  align-content: start;
  gap: 1.5rem;
  margin: 0 auto;
  padding: 1.5rem 2.5rem 2.5rem;
}

.dashboard-shell .topbar {
  min-height: 3.5rem;
  padding: 0 1.25rem;
}

.dashboard-shell .brand-icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.5rem;
}

.dashboard-shell .brand-icon svg {
  width: 1.125rem;
  height: 1.125rem;
}

.dashboard-shell .brand strong {
  font-size: 1.125rem;
}

.topbar {
  display: flex;
  width: 100%;
  max-width: 100%;
  min-height: 4rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid var(--color-base-300);
  border-radius: 0.875rem;
  background: var(--color-base-100);
  padding: 0.625rem 1rem;
  box-shadow: 0 8px 22px -18px rgb(15 23 42 / 35%);
}

.brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 0.75rem;
  color: var(--color-base-content);
  text-decoration: none;
}

.brand-icon {
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 0.75rem;
  background: #e8f2ff;
  color: var(--color-primary);
}

.brand-icon svg {
  width: 1.35rem;
  height: 1.35rem;
}

.brand strong {
  display: block;
  font-size: 1.25rem;
  line-height: 1.1;
}

.brand small {
  display: block;
  margin-top: 0.125rem;
  color: #98a2b3;
  font-size: 0.75rem;
}

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

.nav-actions .btn {
  min-height: 2rem;
  height: 2rem;
}

.mode-pill {
  display: inline-flex;
  min-height: 1.75rem;
  align-items: center;
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  background: #eef4ff;
  padding: 0.25rem 0.625rem;
  color: #475467;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.hero-panel {
  display: grid;
  width: 100%;
  max-width: 100%;
  justify-items: center;
  gap: 1.5rem;
  padding: clamp(2rem, 8vh, 5rem) 0 2rem;
}

.hero-copy {
  max-width: 36rem;
  text-align: center;
}

.hero-copy h1 {
  margin: 0;
  color: var(--color-base-content);
  font-size: clamp(1.55rem, 4vw, 2rem);
  font-weight: 800;
  line-height: 1.2;
}

.hero-copy p {
  margin: 0.625rem 0 0;
  color: #98a2b3;
  font-size: 0.95rem;
  line-height: 1.55;
}

.shorten-card {
  display: grid;
  width: 100%;
  max-width: 34rem;
  gap: 1rem;
  border: 1px solid var(--color-base-300);
  border-radius: 1rem;
  background: var(--color-base-100);
  padding: clamp(1.25rem, 4vw, 1.75rem);
  box-shadow: 0 18px 44px -28px rgb(15 23 42 / 32%);
}

.field-stack {
  display: grid;
  gap: 0.5rem;
}

.field-stack span {
  color: var(--color-base-content);
  font-size: 0.875rem;
  font-weight: 700;
}

.field-stack small {
  color: #98a2b3;
  font-size: 0.75rem;
  line-height: 1.45;
}

.field-stack.compact {
  gap: 0.375rem;
}

.field-stack.compact span {
  color: #667085;
  font-size: 0.78rem;
  font-weight: 600;
}

.input,
.textarea {
  width: 100%;
  max-width: 100%;
  min-height: 2.75rem;
  border-color: #cbd5e1;
  background: #ffffff;
  color: var(--color-base-content);
  font-size: 0.875rem;
}

.input:focus,
.textarea:focus {
  outline: 2px solid rgb(37 99 235 / 18%);
  outline-offset: 1px;
  border-color: var(--color-primary);
}

.textarea {
  min-height: 5rem;
  resize: vertical;
}

.primary-action {
  min-height: 2.9rem;
  font-weight: 800;
}

.card-divider {
  height: 1px;
  background: #d7dde5;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 1.25rem;
}

.link-action {
  min-height: 2.75rem;
  border: 0;
  background: transparent;
  color: #172033;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 700;
}

.link-action:hover,
.link-action:focus-visible {
  color: var(--color-primary);
}

.nav-link-action {
  display: inline-flex;
  align-items: center;
  color: var(--color-primary);
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.user-badge {
  display: inline-flex;
  min-height: 1.75rem;
  max-width: 18rem;
  align-items: center;
  border-radius: 0.625rem;
  background: #f0f3f7;
  padding: 0.25rem 0.75rem;
  color: #667085;
  font-size: 0.75rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-box:empty {
  display: none;
}

.result-box {
  border-top: 1px solid #edf0f4;
  padding-top: 1rem;
}

.app-modal .modal-box {
  width: min(calc(100vw - 2rem), 33rem);
  max-width: 33rem;
  border: 1px solid #c7d2fe;
  border-radius: 1rem;
  background: #ffffff;
  color: var(--color-base-content);
  box-shadow: 0 28px 72px -28px rgb(15 23 42 / 45%);
}

.options-modal {
  display: grid;
  gap: 1.25rem;
}

.counts-modal {
  display: grid;
  gap: 1rem;
  width: min(calc(100vw - 2rem), 24rem) !important;
}

.auth-modal {
  display: grid;
  gap: 1.25rem;
  width: min(calc(100vw - 2rem), 28rem) !important;
}

.manage-modal {
  display: grid;
  gap: 1.25rem;
  width: min(calc(100vw - 2rem), 58rem) !important;
  max-width: 58rem !important;
}

.stats-modal {
  display: grid;
  gap: 1.25rem;
  width: min(calc(100vw - 2rem), 64rem) !important;
  max-width: 64rem !important;
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  color: #667085;
}

.modal-header {
  max-width: 28rem;
  margin: 0 auto;
  text-align: center;
}

.modal-header h2,
.counts-modal h2 {
  margin: 0;
  color: var(--color-base-content);
  font-size: 1.15rem;
  font-weight: 800;
}

.modal-header p {
  margin: 0.5rem 0 0;
  color: #98a2b3;
  font-size: 0.82rem;
  line-height: 1.5;
}

.modal-content {
  display: grid;
  gap: 1rem;
}

.auth-field {
  border: 1px solid #dde3ea;
  border-radius: 0.75rem;
  background: #f8fbff;
  padding: 1rem;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
  border-radius: 0.75rem;
  background: #eef2f7;
  padding: 0.25rem;
}

.auth-tab {
  min-height: 2.5rem;
  border: 0;
  border-radius: 0.55rem;
  background: transparent;
  color: #667085;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 800;
}

.auth-tab.active {
  background: #ffffff;
  color: #172033;
  box-shadow: 0 8px 18px -14px rgb(15 23 42 / 40%);
}

.auth-form {
  display: grid;
  gap: 1rem;
}

.auth-message:empty {
  display: none;
}

.turnstile-slot {
  display: grid;
  justify-items: center;
  min-height: 0;
}

.turnstile-slot:not([hidden]) {
  min-height: 4.25rem;
}

.turnstile-slot iframe {
  max-width: 100%;
}

.manage-toolbar {
  display: flex;
  justify-content: flex-end;
}

.manage-list {
  display: grid;
  max-height: min(62dvh, 42rem);
  gap: 1rem;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.managed-card {
  display: grid;
  gap: 1rem;
  border: 1px solid #dde3ea;
  border-radius: 0.875rem;
  background: #ffffff;
  padding: 1rem;
}

.managed-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.managed-key {
  display: inline-block;
  color: var(--color-primary);
  font-weight: 800;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.managed-url,
.managed-meta {
  display: block;
  margin-top: 0.25rem;
  color: #667085;
  font-size: 0.78rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.managed-count {
  flex: 0 0 auto;
  color: #172033;
  font-size: 0.875rem;
  font-weight: 800;
  white-space: nowrap;
}

.managed-edit {
  display: grid;
  gap: 0.75rem;
}

.managed-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.danger-action {
  border-color: #fecaca;
  color: #dc2626;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.dashboard-title {
  display: grid;
  gap: 0.25rem;
}

.dashboard-title h1 {
  margin: 0;
  color: #172033;
  font-size: clamp(1.35rem, 2.6vw, 1.55rem);
  font-weight: 850;
  line-height: 1.2;
}

.dashboard-title p {
  margin: 0;
  color: #98a2b3;
  font-size: 0.85rem;
}

.dashboard-stats {
  display: flex;
  gap: 1rem;
}

.dashboard-stat {
  display: grid;
  min-width: 5.5rem;
  gap: 0.125rem;
}

.dashboard-stat strong {
  color: #172033;
  font-size: 1.5rem;
  font-weight: 850;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.dashboard-stat.accent strong {
  color: var(--color-primary);
}

.dashboard-stat span {
  color: #98a2b3;
  font-size: 0.7rem;
  font-weight: 700;
}

.url-table-panel {
  display: grid;
  overflow: hidden;
  align-content: start;
  border: 1px solid #dde3ea;
  border-radius: 0.875rem;
  background: #ffffff;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid #edf0f4;
  padding: 0.875rem 1.25rem;
}

.table-toolbar h2 {
  margin: 0;
  color: #172033;
  font-size: 0.95rem;
  font-weight: 850;
}

.url-table {
  display: grid;
}

.url-table-head,
.url-table-row {
  display: grid;
  grid-template-columns: 12.5rem minmax(0, 1fr) 6.25rem 7.5rem 16rem;
  align-items: center;
  column-gap: 1rem;
}

.url-table-head {
  min-height: 3rem;
  background: #f0f3f7;
  padding: 0 1.25rem;
  color: #667085;
  font-size: 0.75rem;
  font-weight: 800;
}

.url-table-row {
  min-height: 3.5rem;
  border-bottom: 1px solid #edf0f4;
  padding: 0 1.25rem;
}

.url-table-row:last-child {
  border-bottom: 0;
}

.url-cell {
  min-width: 0;
  color: #667085;
  font-size: 0.82rem;
}

.short-cell {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.destination-cell span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.count-cell {
  color: #172033;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.date-cell {
  white-space: nowrap;
}

.action-cell {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.table-action {
  min-height: 2rem;
  border: 0;
  background: transparent;
  color: #667085;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
}

.table-action:hover,
.table-action:focus-visible {
  color: #172033;
  text-decoration: underline;
}

.table-action.primary {
  color: var(--color-primary);
}

.table-action.danger {
  color: #dc2626;
}

.custom-tag {
  border-radius: 0.35rem;
  background: #e8f2ff;
  padding: 0.1rem 0.35rem;
  color: var(--color-primary);
  font-size: 0.65rem;
  font-weight: 800;
}

.url-edit-panel {
  display: none;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1fr) minmax(10rem, 18rem) auto;
  align-items: end;
  gap: 0.75rem;
  border-top: 1px dashed #cbd5e1;
  margin-top: 0.75rem;
  padding: 0.875rem 0 1rem;
}

.url-table-row.is-editing {
  align-items: start;
  padding-top: 0.875rem;
}

.url-table-row.is-editing .url-edit-panel {
  display: grid;
}

.edit-actions {
  display: flex;
  gap: 0.5rem;
}

.dashboard-empty {
  margin: 1rem;
}

.empty-panel {
  display: grid;
  gap: 0.35rem;
  border: 1px dashed #cbd5e1;
  border-radius: 0.875rem;
  padding: 2rem 1rem;
  color: #667085;
  text-align: center;
}

.empty-panel strong {
  color: #172033;
}

.compact-empty {
  min-height: 10rem;
  align-content: center;
  padding: 1rem;
}

.stats-content {
  display: grid;
  max-height: min(68dvh, 46rem);
  gap: 1rem;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.stat-card,
.stats-panel {
  border: 1px solid #dde3ea;
  border-radius: 0.875rem;
  background: #ffffff;
}

.stat-card {
  display: grid;
  gap: 0.35rem;
  padding: 0.9rem;
}

.stat-card span {
  color: #667085;
  font-size: 0.75rem;
  font-weight: 700;
}

.stat-card strong {
  color: #172033;
  font-size: clamp(1.15rem, 2.6vw, 1.55rem);
  font-weight: 850;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.stats-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(15rem, 0.65fr);
  gap: 1rem;
}

.stats-chart-full,
.stats-chart-grid {
  display: grid;
  gap: 1rem;
}

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

.stats-side,
.stats-dimensions {
  display: grid;
  gap: 1rem;
}

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

.stats-panel {
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

.chart-panel {
  min-width: 0;
}

.chart-canvas {
  position: relative;
  width: 100%;
  min-width: 0;
}

.line-chart {
  height: 18rem;
}

.pie-chart {
  height: 18rem;
}

.stats-panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.stats-panel__head h3 {
  margin: 0;
  color: #172033;
  font-size: 0.95rem;
  font-weight: 850;
}

.stats-panel__head span {
  color: #98a2b3;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: right;
}

.bar-chart {
  display: flex;
  min-height: 11rem;
  align-items: flex-end;
  gap: 0.55rem;
  overflow-x: auto;
  padding-top: 0.5rem;
}

.bar-item {
  display: grid;
  min-width: 3.5rem;
  flex: 1 0 3.5rem;
  justify-items: center;
  gap: 0.4rem;
}

.bar-value,
.bar-label {
  color: #667085;
  font-size: 0.68rem;
  font-weight: 700;
  text-align: center;
  overflow-wrap: anywhere;
}

.bar-track {
  display: flex;
  width: 100%;
  height: 7.75rem;
  align-items: flex-end;
  justify-content: center;
  border-radius: 0.65rem;
  background: #f1f5f9;
  padding: 0.25rem;
}

.bar-fill {
  width: 100%;
  border-radius: 0.5rem;
  background: #2563eb;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 28%);
}

.dimension-list {
  display: grid;
  gap: 0.85rem;
}

.dimension-row {
  display: grid;
  gap: 0.35rem;
}

.dimension-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: #667085;
  font-size: 0.78rem;
  font-weight: 700;
}

.dimension-head span {
  overflow-wrap: anywhere;
}

.dimension-head strong {
  color: #172033;
  font-variant-numeric: tabular-nums;
}

.dimension-track {
  height: 0.45rem;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f7;
}

.dimension-fill {
  height: 100%;
  border-radius: 999px;
  background: #0ea5e9;
}

.stats-empty {
  margin: 0;
  color: #98a2b3;
  font-size: 0.8rem;
}

.section-collapse {
  overflow: hidden;
  border: 1px solid #dde3ea;
  border-radius: 0.75rem;
  background: #ffffff;
}

.section-collapse[open] {
  border-color: #c7d2fe;
}

.section-summary {
  display: flex;
  min-height: 3rem;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  list-style: none;
}

.section-summary::-webkit-details-marker {
  display: none;
}

.section-summary::marker {
  display: none;
}

.section-summary span {
  flex: 1;
  color: var(--color-base-content);
  font-size: 0.875rem;
  font-weight: 700;
}

.section-summary small {
  color: #98a2b3;
  font-size: 0.75rem;
}

.section-icon,
.chevron {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
}

.section-icon {
  color: var(--color-primary);
}

.chevron {
  color: #98a2b3;
  transition: transform 180ms ease;
}

.section-collapse[open] .chevron {
  transform: rotate(180deg);
}

.section-body {
  border-top: 1px solid #edf0f4;
  padding: 0 1rem 1rem;
}

.counts-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 2.75rem;
  gap: 0.5rem;
}

.counts-box {
  min-height: 1.5rem;
}

.counts-box > p {
  margin: 0;
  color: #98a2b3;
  font-size: 0.78rem;
  text-align: center;
}

.result-stack {
  display: grid;
  gap: 0.75rem;
}

.short-url {
  display: block;
  color: var(--color-primary);
  font-size: 1rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.meta-line {
  color: #667085;
  font-size: 0.82rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.counts-stat {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.counts-value {
  color: var(--color-primary);
  font-size: 2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.counts-label {
  color: #667085;
  font-size: 0.82rem;
}

@media (max-width: 640px) {
  .app-shell {
    padding: 0.875rem;
  }

  .topbar {
    border-radius: 0.75rem;
  }

  .brand strong {
    font-size: 1rem;
  }

  .brand small {
    display: none;
  }

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

  .mode-pill {
    display: none;
  }

  .hero-panel {
    justify-items: start;
    padding-top: 2rem;
  }

  .hero-copy {
    width: calc(100vw - 1.75rem);
    max-width: calc(100vw - 1.75rem);
    justify-self: start;
  }

  .hero-copy p {
    max-width: 20rem;
    margin-left: auto;
    margin-right: auto;
  }

  .shorten-card {
    width: min(calc(100vw - 1.75rem), 20.5rem);
    max-width: 20.5rem;
    justify-self: start;
  }

  .inline-actions {
    justify-content: space-between;
    gap: 0.75rem;
  }

  .app-modal .modal-box {
    padding: 1.25rem;
  }

  .managed-card__head {
    display: grid;
  }

  .dashboard-shell {
    padding: 0.875rem;
  }

  .dashboard-header {
    display: grid;
    gap: 1rem;
  }

  .dashboard-stats {
    width: 100%;
    justify-content: space-between;
  }

  .url-table-panel {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .table-toolbar {
    border: 1px solid #dde3ea;
    border-radius: 0.75rem;
    background: #ffffff;
  }

  .url-table {
    gap: 0.75rem;
    margin-top: 0.75rem;
  }

  .url-table-head {
    display: none;
  }

  .url-table-row {
    grid-template-columns: 1fr;
    min-height: auto;
    gap: 0.6rem;
    border: 1px solid #dde3ea;
    border-radius: 0.875rem;
    background: #ffffff;
    padding: 1rem;
  }

  .url-cell {
    display: grid;
    gap: 0.25rem;
  }

  .short-cell,
  .action-cell {
    display: flex;
  }

  .destination-cell span {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .count-cell::before {
    content: "조회수";
    color: #98a2b3;
    font-size: 0.7rem;
    font-weight: 700;
  }

  .date-cell::before {
    content: "생성일";
    color: #98a2b3;
    font-size: 0.7rem;
    font-weight: 700;
  }

  .url-edit-panel {
    grid-template-columns: 1fr;
    width: 100%;
  }

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

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

  .line-chart,
  .pie-chart {
    height: 16rem;
  }
}

@media (max-width: 420px) {
  .stats-grid,
  .stats-dimensions {
    grid-template-columns: 1fr;
  }

  .stats-panel__head {
    display: grid;
    gap: 0.25rem;
  }

  .stats-panel__head span {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
