:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --text: #172033;
  --muted: #5c697d;
  --line: #d8dee8;
  --primary: #0b6bcb;
  --primary-dark: #084f96;
  --accent: #13845b;
  --danger: #bd2b2b;
  --warning: #8a5b00;
  --touch: 56px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
}

body {
  font-size: 18px;
  line-height: 1.55;
}

a {
  color: var(--primary);
}

.app-shell {
  max-width: 880px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--panel);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #e8f2ff;
  color: var(--primary-dark);
  font-weight: 900;
}

.brand-lines {
  min-width: 0;
}

.brand-title,
.brand-subtitle {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.page {
  padding: 22px 16px 40px;
}

.center-page {
  display: grid;
  min-height: calc(100vh - 70px);
  align-content: center;
}

.section {
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.section:first-child {
  border-top: 0;
}

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

h1 {
  margin-bottom: 18px;
  font-size: 30px;
  line-height: 1.2;
}

h2 {
  margin-bottom: 14px;
  font-size: 24px;
  line-height: 1.25;
}

h3 {
  margin-bottom: 10px;
  font-size: 20px;
  line-height: 1.3;
}

.lead {
  color: var(--muted);
  font-size: 18px;
}

.large-label {
  display: block;
  margin-bottom: 8px;
  font-size: 18px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: var(--touch);
  padding: 12px 14px;
  border: 2px solid #bdc7d5;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

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

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: 4px solid #ffcf33;
  outline-offset: 2px;
}

.field {
  margin-bottom: 18px;
}

.form-grid {
  display: grid;
  gap: 14px;
}

@media (min-width: 720px) {
  .form-grid.two {
    grid-template-columns: 1fr 1fr;
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: var(--touch);
  width: 100%;
  padding: 14px 18px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #e9edf3;
  color: var(--text);
  font: inherit;
  font-weight: 850;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover {
  filter: brightness(0.98);
}

.btn.primary {
  background: var(--primary);
  color: #fff;
}

.btn.accent {
  background: var(--accent);
  color: #fff;
}

.btn.danger {
  background: var(--danger);
  color: #fff;
}

.btn.outline {
  border-color: #95a4b8;
  background: #fff;
}

.btn.small {
  width: auto;
  min-height: 42px;
  padding: 8px 12px;
  font-size: 15px;
}

.btn-row {
  display: grid;
  gap: 12px;
}

@media (min-width: 620px) {
  .btn-row.inline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.home-actions {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.home-actions .btn.primary {
  min-height: 88px;
  font-size: 24px;
}

.admin-link {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.notice,
.error,
.success {
  margin: 14px 0;
  padding: 14px;
  border-radius: 8px;
  font-weight: 750;
}

.notice {
  background: #eef5ff;
  border: 1px solid #b9d5f6;
}

.error {
  background: #fff0f0;
  border: 1px solid #efb4b4;
  color: #7a1515;
}

.success {
  background: #edf9f3;
  border: 1px solid #a7ddc4;
  color: #145d41;
}

.work-summary {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 2px solid #cfd8e5;
  border-radius: 8px;
  background: #f8fafc;
}

.summary-item {
  display: grid;
  gap: 2px;
}

.summary-label {
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
}

.summary-value {
  font-size: 22px;
  font-weight: 850;
  word-break: break-word;
}

.list {
  display: grid;
  gap: 12px;
}

.list-item {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.list-title {
  font-size: 19px;
  font-weight: 850;
}

.list-meta {
  color: var(--muted);
  font-size: 15px;
  font-weight: 650;
}

.pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 32px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #edf1f6;
  color: #2c3a4d;
  font-size: 14px;
  font-weight: 850;
}

.pill.public {
  background: #e8f7ef;
  color: #126143;
}

.pill.private {
  background: #fff4da;
  color: #745000;
}

.scanner-box {
  overflow: hidden;
  min-height: 310px;
  border: 3px solid #22324a;
  border-radius: 8px;
  background: #101824;
}

#reader {
  width: 100%;
}

#reader video {
  width: 100% !important;
}

.video-player {
  display: none;
  margin-top: 14px;
}

.video-player video {
  width: 100%;
  max-height: 55vh;
  background: #000;
  border-radius: 8px;
}

.admin-menu {
  display: grid;
  gap: 12px;
}

.repeat-block {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.qr-preview {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 18px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.qr-label {
  text-align: center;
  font-weight: 850;
}

.hidden {
  display: none !important;
}

@media print {
  body {
    background: #fff;
  }

  .topbar,
  .no-print,
  .btn:not(.print-keep) {
    display: none !important;
  }

  .app-shell {
    max-width: none;
  }
}
