:root {
  --bg: #f6f5ef;
  --panel: #ffffff;
  --ink: #17212b;
  --muted: #64707d;
  --line: #d9dee4;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --primary-soft: #e3f3f1;
  --accent: #b45309;
  --danger: #b42318;
  --danger-soft: #fff0ed;
  --shadow: 0 18px 46px rgba(23, 33, 43, 0.1);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button,
a.button {
  min-height: 42px;
}

button {
  cursor: pointer;
}

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 28px clamp(18px, 4vw, 52px) 16px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 2rem;
  line-height: 1.1;
}

h2 {
  margin-bottom: 0;
  font-size: 1.08rem;
}

h3 {
  margin-bottom: 0;
  font-size: 1rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(290px, 380px) minmax(0, 1fr);
  gap: 18px;
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto 40px;
  align-items: start;
}

.panel,
.qr-card,
.gone-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 20px;
}

.creator-panel {
  position: sticky;
  top: 18px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.library-heading {
  align-items: center;
}

.muted {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.code-form {
  display: grid;
  gap: 10px;
}

label {
  color: #344054;
  font-size: 0.88rem;
  font-weight: 700;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.button,
a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 13px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.primary {
  margin-top: 6px;
  background: var(--primary);
  color: #fff;
}

.primary:hover {
  background: var(--primary-dark);
}

.secondary {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.secondary:hover {
  background: #f7f8f9;
}

.danger {
  background: var(--danger-soft);
  border-color: #ffd2ca;
  color: var(--danger);
}

.danger:hover {
  border-color: var(--danger);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.stats-grid > div {
  min-height: 72px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbf8;
}

.stat-value,
.stat-label {
  display: block;
}

.stat-value {
  font-size: 1.45rem;
  font-weight: 900;
}

.stat-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.status-pill {
  flex: 0 0 auto;
  max-width: 220px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: #fff;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill[data-tone="success"] {
  border-color: #9dd8ce;
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.status-pill[data-tone="error"] {
  border-color: #ffc4ba;
  background: var(--danger-soft);
  color: var(--danger);
}

.codes-list {
  display: grid;
  gap: 14px;
}

.qr-card {
  display: grid;
  grid-template-columns: 184px minmax(0, 1fr);
  gap: 16px;
  padding: 14px;
  box-shadow: none;
}

.qr-frame {
  display: grid;
  place-items: center;
  width: 168px;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.qr-frame img {
  display: block;
  width: 148px;
  height: 148px;
  object-fit: contain;
}

.card-body {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.title-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.active-badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 0.74rem;
  font-weight: 900;
}

.target-link,
.short-link {
  display: block;
  color: var(--primary-dark);
  overflow-wrap: anywhere;
}

.target-link {
  font-weight: 700;
}

.short-link {
  color: var(--muted);
  font-size: 0.88rem;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}

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

.editor {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(220px, 2fr) auto auto;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.editor[hidden],
[hidden] {
  display: none !important;
}

.empty-state {
  border: 1px dashed #b9c2cc;
  border-radius: 8px;
  padding: 28px;
  color: var(--muted);
  background: #fbfbf8;
  text-align: center;
}

.gone-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.gone-panel {
  width: min(520px, 100%);
  padding: 28px;
}

.gone-panel h1 {
  font-size: 1.6rem;
  margin-bottom: 10px;
}

.gone-panel p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

@media (max-width: 820px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .creator-panel {
    position: static;
  }

  .qr-card {
    grid-template-columns: 1fr;
  }

  .qr-frame {
    width: min(220px, 100%);
  }

  .qr-frame img {
    width: min(188px, 78vw);
    height: min(188px, 78vw);
  }

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

  .button,
  a.button {
    width: 100%;
  }
}
