:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --code: #ffffff;
  --line: rgba(0, 0, 0, .12);
  --line-strong: rgba(0, 0, 0, .2);
  --text: #111827;
  --sub: #856259;
  --topbar: #ffffff;
  --primary: #fa9403;
  --primary-dark: #dd7e00;
  --primary-soft: #fff3df;
  --muted: #667085;
  --soft: #f6f7f8;
  --ok: #15803d;
  --ok-soft: #ecfdf3;
  --bad: #dc2626;
  --bad-soft: #fef2f2;
  --shadow: 0 18px 60px rgba(17, 24, 39, .08);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --surface: #000000;
  --code: #202020;
  --line: rgba(255, 255, 255, .16);
  --line-strong: rgba(255, 255, 255, .25);
  --text: #e5e7eb;
  --sub: #d9b8a0;
  --topbar: #000000;
  --muted: #9ca3af;
  --soft: #111111;
  --primary-soft: #2a1b08;
  --ok: #4ade80;
  --ok-soft: #092016;
  --bad: #f87171;
  --bad-soft: #2b0e0e;
  --shadow: 0 18px 60px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}
button,
input,
select { font: inherit; }
button,
a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.dt-topbar {
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
  background: var(--topbar);
  border-bottom: 1px solid var(--line);
}
.dt-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.dt-logo { display: block; flex: 0 1 auto; }
.dt-logotop { width: 500px; max-width: 100%; height: auto; display: block; }
.dt-title { color: var(--sub); font-weight: 700; white-space: nowrap; }
.dt-actions { display: flex; gap: 8px; align-items: center; }

button,
.dt-secondary-btn,
.sl-open {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 12px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: border-color .16s ease, color .16s ease, background .16s ease, transform .16s ease;
}
button:hover,
.dt-secondary-btn:hover,
.sl-open:hover { border-color: var(--primary); color: var(--primary); }
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 28%, transparent);
  outline-offset: 2px;
}

.dt-main { width: 100%; margin: 18px 0; padding: 0 14px 40px; }
.sl-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: 16px;
  align-items: start;
}
.sl-stage,
.sl-panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: var(--surface);
}
.sl-panel { position: sticky; top: 14px; }

.sl-stage-head {
  min-height: 70px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 2px 2px 14px;
}
.sl-stage-head h1,
.sl-panel h1,
.sl-empty h2,
.sl-result h2,
.sl-error-card h1 {
  margin: 0;
  color: var(--sub);
  font-weight: 600;
}
.sl-stage-head h1,
.sl-panel h1 { font-size: 23px; }
.sl-stage-head p,
.sl-panel-heading p,
.sl-empty p,
.sl-error-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.sl-count {
  flex: 0 0 auto;
  margin-top: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 11px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.sl-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  border-radius: 12px;
  background: var(--soft);
}
.sl-search { position: relative; }
.sl-search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 17px;
  height: 17px;
  color: var(--muted);
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2;
  transform: translateY(-50%);
  pointer-events: none;
}
input[type="text"],
input[type="url"],
input[type="date"],
input[type="search"],
select {
  width: 100%;
  min-height: 41px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  background: var(--code);
  color: var(--text);
  font-size: 13px;
}
.sl-search input { padding-left: 38px; margin: 0; }
input::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }

.sl-panel-heading { padding: 2px 2px 16px; }
.sl-kicker {
  display: block;
  margin-bottom: 5px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.sl-row { margin-bottom: 14px; }
.sl-row > label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
}
.required { color: var(--primary); }
.sl-help {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}
.sl-slug-input {
  display: flex;
  align-items: stretch;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--code);
  overflow: hidden;
}
.sl-slug-input:focus-within {
  outline: 3px solid color-mix(in srgb, var(--primary) 28%, transparent);
  outline-offset: 2px;
}
.sl-slug-input span {
  display: flex;
  align-items: center;
  min-width: 0;
  max-width: 55%;
  padding: 0 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sl-slug-input input {
  min-width: 70px;
  border: 0;
  border-radius: 0;
  padding-left: 2px;
}
.sl-slug-input input:focus-visible { outline: 0; }

.sl-primary-btn,
.sl-primary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--primary);
  border-radius: 10px;
  padding: 10px 14px;
  color: #ffffff;
  background: var(--primary);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
.sl-primary-btn:hover,
.sl-primary-link:hover {
  border-color: var(--primary-dark);
  color: #ffffff;
  background: var(--primary-dark);
}
.sl-primary-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2;
}
.sl-primary-btn:disabled { opacity: .58; cursor: default; }
.sl-primary-btn[aria-busy="true"] { cursor: progress; }
.sl-form-status { min-height: 20px; margin: 8px 0 0; color: var(--bad); font-size: 12px; font-weight: 700; }
.sl-form-status.ok { color: var(--ok); }

.sl-result {
  margin-top: 12px;
  border: 1px solid color-mix(in srgb, var(--primary) 40%, var(--line));
  border-radius: 12px;
  padding: 13px;
  background: var(--primary-soft);
}
.sl-result h2 { color: var(--text); font-size: 16px; }
.sl-result-url { display: flex; gap: 7px; margin-top: 10px; }
.sl-result-url input { min-width: 0; background: var(--surface); font-weight: 700; }
.sl-result-url button { flex: 0 0 auto; background: var(--surface); }
.sl-result > a { display: inline-block; margin-top: 9px; color: var(--sub); font-size: 12px; font-weight: 700; text-decoration: none; }
.sl-result > a:hover { color: var(--primary); }

.sl-list { display: grid; gap: 10px; }
.sl-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "main actions" "meta actions";
  gap: 5px 16px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: var(--surface);
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.sl-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.sl-card.is-expired { opacity: .72; }
.sl-card-main { grid-area: main; display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.sl-link-icon,
.sl-empty-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 11px;
  color: var(--primary);
  background: var(--primary-soft);
}
.sl-link-icon svg,
.sl-empty-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}
.sl-card-copy { min-width: 0; }
.sl-card-title-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sl-card-title { margin: 0; overflow: hidden; color: var(--text); font-size: 14px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.sl-badge {
  display: none;
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 3px 7px;
  color: var(--bad);
  background: var(--bad-soft);
  font-size: 10px;
  font-weight: 800;
}
.sl-card.is-expired .sl-badge { display: inline-block; }
.sl-short-url {
  display: inline-block;
  max-width: 100%;
  margin-top: 3px;
  color: var(--primary);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sl-short-url:hover { text-decoration: underline; }
.sl-target-url { margin: 3px 0 0; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.sl-card-meta {
  grid-area: meta;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  padding-left: 54px;
  color: var(--muted);
  font-size: 11px;
}
.sl-card-actions { grid-area: actions; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.sl-card-actions button,
.sl-card-actions a { font-size: 12px; }
.sl-card-actions .danger:hover { border-color: var(--bad); color: var(--bad); }

.sl-notice {
  margin-bottom: 10px;
  border: 1px solid color-mix(in srgb, var(--bad) 35%, var(--line));
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--bad);
  background: var(--bad-soft);
  font-size: 12px;
  font-weight: 700;
}
.sl-notice.ok { border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); color: var(--ok); background: var(--ok-soft); }
.sl-empty {
  min-height: 390px;
  display: grid;
  place-content: center;
  justify-items: center;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 30px;
  text-align: center;
  background: var(--soft);
}
.sl-empty .sl-empty-icon { width: 58px; height: 58px; margin-bottom: 14px; border-radius: 15px; }
.sl-empty .sl-empty-icon svg { width: 28px; height: 28px; }
.sl-empty h2 { color: var(--text); font-size: 18px; }
.sl-empty p { max-width: 300px; }
.is-hidden { display: none !important; }
.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; }

.sl-error-page { display: grid; min-height: 100vh; place-items: center; padding: 20px; }
.sl-error-card {
  width: min(100%, 520px);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 34px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}
.sl-error-card .sl-empty-icon { width: 58px; height: 58px; margin: 0 auto 16px; }
.sl-error-card h1 { color: var(--text); font-size: 25px; }
.sl-error-card p { margin-bottom: 20px; }
.sl-error-card .sl-primary-link { width: auto; }

@media (max-width: 1100px) {
  .sl-shell { grid-template-columns: 1fr; }
  .sl-panel { position: static; grid-row: 1; }
}

@media (max-width: 720px) {
  .dt-topbar { height: auto; min-height: 84px; padding-block: 14px; }
  .dt-title { display: none; }
  .dt-logotop { width: min(380px, 70vw); }
  .dt-actions button { padding: 8px 9px; font-size: 12px; }
  .dt-main { margin-top: 12px; padding-inline: 10px; }
  .sl-toolbar { grid-template-columns: 1fr; }
  .sl-card { grid-template-columns: 1fr; grid-template-areas: "main" "meta" "actions"; }
  .sl-card-meta { padding-left: 54px; }
  .sl-card-actions { justify-content: flex-start; padding-left: 54px; margin-top: 8px; }
}

@media (max-width: 470px) {
  .sl-stage,
  .sl-panel { padding: 11px; }
  .sl-stage-head { align-items: center; }
  .sl-stage-head p { display: none; }
  .sl-stage-head h1,
  .sl-panel h1 { font-size: 20px; }
  .sl-link-icon { display: none; }
  .sl-card-meta,
  .sl-card-actions { padding-left: 0; }
  .sl-result-url { display: grid; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
