:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #18202a;
  --muted: #657184;
  --border: #d8dee8;
  --accent: #1677ff;
  --accent-dark: #0759c7;
  --danger: #b42318;
  --shadow: 0 14px 38px rgba(24, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-pill {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  font-size: 14px;
  white-space: nowrap;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 20px;
  margin-bottom: 18px;
}

.subtle {
  color: var(--muted);
  margin: 6px 0 0;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 18px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
}

.form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  font-size: 14px;
  font-weight: 650;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 11px 12px;
  color: var(--text);
  background: #fff;
  font: inherit;
}

textarea {
  resize: vertical;
  min-height: 170px;
}

button,
.button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
}

button:hover,
.button:hover {
  background: var(--accent-dark);
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.ghost,
.secondary {
  color: var(--text);
  background: #eef2f7;
}

.ghost:hover,
.secondary:hover {
  background: #dfe6ef;
}

.tabs {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 18px;
}

.tab {
  background: #fff;
  color: var(--text);
  min-width: 96px;
  border-radius: 0;
}

.tab.active {
  background: var(--text);
  color: #fff;
}

.options {
  display: grid;
  grid-template-columns: minmax(160px, 220px) repeat(3, minmax(150px, 1fr));
  gap: 14px;
  align-items: end;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 43px;
}

.check input {
  width: 18px;
  height: 18px;
}

.code {
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: #f9fbfd;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 4px;
  text-align: center;
  padding: 16px;
  margin-bottom: 16px;
}

.qr {
  display: block;
  width: min(240px, 100%);
  aspect-ratio: 1;
  margin: 0 auto 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.actions,
.lookup {
  display: flex;
  gap: 10px;
}

.lookup input {
  text-transform: uppercase;
}

.content {
  display: grid;
  gap: 14px;
}

.text-box {
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfe;
}

.file-box {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfe;
  word-break: break-word;
}

.preview {
  display: block;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: min(420px, calc(100% - 32px));
  background: #18202a;
  color: #fff;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.error {
  color: var(--danger);
}

.hidden {
  display: none !important;
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 20px, 980px);
    padding-top: 18px;
  }

  .grid,
  .options {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .actions,
  .lookup {
    flex-direction: column;
  }

  h1 {
    font-size: 26px;
  }
}
