:root {
  --studio-purple: #7D65FC;
  --studio-orange: #F5AE37;
  --studio-green: #A0C594;
  --black: #000000;
  --white: #FFFFFF;
  --canvas: #f4f5f6;
  --line: #d9dde2;
  --muted: #65707c;
  --danger: #b42318;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--black);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

a { color: var(--studio-purple); text-underline-offset: 3px; }
button, input { font: inherit; }
button, a { cursor: pointer; }

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cbd2d9;
  border-radius: 4px;
  padding: 9px 12px;
  color: var(--black);
  background: var(--white);
}

input:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid rgba(125, 101, 252, .3);
  outline-offset: 2px;
  border-color: var(--studio-purple);
}

label { display: grid; gap: 7px; font-weight: 750; }

.site-header, .site-footer, .page {
  width: min(1030px, calc(100% - 32px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 92px;
  gap: 20px;
}

.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--black); text-decoration: none; }
.brand strong { font-size: 1.35rem; letter-spacing: 0; }
.brand-logo { width: 150px; height: 150px; object-fit: contain; object-position: left center; }
.brand-divider { width: 1px; height: 28px; background: var(--line); }

.site-nav { display: flex; gap: 18px; }
.site-nav a { color: var(--black); font-size: .94rem; font-weight: 720; text-decoration: none; }
.site-nav a:hover { color: var(--studio-purple); }

.page { padding: 24px 0 54px; }

.hero { padding: clamp(42px, 8vw, 92px) 0; }
.hero h1 { max-width: 760px; margin: 0; font-size: clamp(2.3rem, 8vw, 5.4rem); line-height: .95; }
.hero p { max-width: 620px; color: var(--muted); font-size: 1.12rem; }
.hero-actions { margin-top: 26px; }

.manage-shell { max-width: 860px; margin: 36px auto 0; }
.link-creator { margin-bottom: 38px; }
.link-creator h1 { margin: 0 0 20px; font-size: 1.45rem; letter-spacing: 0; }

.shorten-form { display: grid; gap: 10px; }
.url-field label, .code-field label { font-size: .94rem; }
.code-input { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: stretch; }
.code-input span {
  display: flex; align-items: center; min-height: 42px; border: 1px solid #cbd2d9; border-right: 0;
  border-radius: 4px 0 0 4px; padding: 0 12px; color: #38424d; background: #e9edf0; font-weight: 700;
}
.code-input input { border-radius: 0 4px 4px 0; }

.button, button.button, a.button {
  display: inline-flex; min-height: 40px; align-items: center; justify-content: center; border: 1px solid transparent;
  border-radius: 4px; padding: 8px 12px; font-weight: 750; text-decoration: none; white-space: nowrap;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}
.button.primary { color: var(--white); background: var(--studio-purple); }
.button.primary:hover { background: #6048e8; }
.create-button { width: 100%; margin-top: 12px; min-height: 48px; font-size: 1.04rem; }
.button.secondary { color: var(--black); border-color: #cbd2d9; background: var(--white); }
.button.secondary:hover { border-color: var(--studio-purple); background: #f5f3ff; }
.button.ghost { color: var(--black); background: transparent; }
.button.danger { color: var(--danger); border-color: transparent; background: transparent; }
.button.danger:hover { background: #fff0ef; }
.button.small { min-height: 32px; padding: 5px 8px; font-size: .78rem; }

.alert { margin: 0 0 18px; border: 1px solid var(--line); border-left: 4px solid var(--studio-purple); border-radius: 4px; padding: 12px 14px; background: var(--white); }
.alert ul { margin: 8px 0 0; padding-left: 20px; }
.alert-success { border-left-color: #4b8a3e; }
.alert-warning { border-left-color: var(--studio-orange); }
.alert-danger { border-left-color: var(--danger); }

.link-library { border-top: 1px solid var(--line); padding-top: 28px; }
.table-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.table-toolbar h2 { margin: 0; font-size: 1.45rem; }
.muted { margin: 4px 0 0; color: var(--muted); }
.filter-form { display: flex; align-items: center; gap: 8px; }
.filter-form input { min-height: 38px; width: 220px; }
.table-wrap { overflow-x: auto; background: var(--white); }
table { width: 100%; min-width: 820px; border-collapse: collapse; }
th, td { border-bottom: 1px solid var(--line); padding: 12px 10px; text-align: left; vertical-align: middle; }
th { color: #37414c; font-size: .76rem; font-weight: 800; text-transform: uppercase; }
tbody tr:nth-child(odd) { background: #f0f2f4; }
tbody tr:hover { background: #efecff; }
.clicks { display: inline-flex; min-width: 28px; justify-content: center; font-weight: 800; }
.url-cell { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actions, .button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.actions form { margin: 0; }
.empty-state { border-top: 1px solid var(--line); padding: 24px 4px; color: var(--muted); }

.panel { margin-bottom: 20px; padding: clamp(18px, 3vw, 28px); border: 1px solid var(--line); border-radius: 4px; background: var(--white); }
.narrow { max-width: 520px; margin-inline: auto; }
.centered { text-align: center; }
.stack { display: grid; gap: 16px; }
.page-heading { margin-bottom: 18px; }
.page-heading h1, .panel h1, .panel h2 { margin: 0; }
.eyebrow { margin: 0 0 8px; color: var(--studio-purple); font-size: .78rem; font-weight: 800; text-transform: uppercase; }

.qr-panel { max-width: 700px; margin: 42px auto; text-align: center; }
.qr-panel h1 { font-size: clamp(1.1rem, 4vw, 1.7rem); word-break: break-word; }
.qr-code { display: flex; justify-content: center; margin: 24px 0; }
.qr-code img { width: min(340px, 100%); height: auto; border: 1px solid var(--line); border-radius: 4px; }
.qr-panel .button-row { justify-content: center; }

.site-footer { display: flex; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); padding: 22px 0 30px; color: var(--muted); font-size: .84rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 720px) {
  .site-header, .site-footer, .page { width: min(100% - 24px, 1030px); }
  .site-header { min-height: 72px; gap: 12px; }
  .brand { gap: 8px; }
  .brand-logo { width: 56px; height: 56px; }
  .brand-divider { height: 22px; }
  .brand strong { font-size: 1.1rem; }
  .site-nav { gap: 10px; }
  .site-nav a { font-size: .84rem; }
  .page { padding-top: 14px; }
  .manage-shell { margin-top: 8px; }
  .link-creator { margin-bottom: 30px; }
  .link-creator h1, .table-toolbar h2 { font-size: 1.25rem; }
  .table-toolbar, .filter-form { display: grid; width: 100%; }
  .filter-form label, .filter-form input { width: 100%; }
  .filter-form .button { width: 100%; }
  .table-wrap { overflow: visible; background: transparent; }
  table { min-width: 0; }
  thead { display: none; }
  tbody { display: grid; gap: 12px; }
  tbody tr { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: 4px; background: var(--white); }
  tbody tr:nth-child(odd) { background: var(--white); }
  tbody tr:hover { background: var(--white); }
  td { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; border: 0; padding: 0; text-align: left; }
  td::before { content: attr(data-label); color: var(--muted); font-size: .76rem; font-weight: 800; text-transform: uppercase; }
  .url-cell { max-width: none; white-space: normal; overflow-wrap: anywhere; }
  .actions { gap: 7px; }
  .qr-panel { margin: 18px auto; }
  .qr-panel .button-row { display: grid; }
  .qr-panel .button-row .button { width: 100%; }
  .site-footer { flex-direction: column; }
}
