:root {
  color-scheme: light;
  --bg: #eef2f6;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --ink: #17212b;
  --muted: #697586;
  --line: #d8dee8;
  --blue: #1769e0;
  --green: #14875a;
  --red: #c23434;
  --amber: #b86b00;
  --shadow: 0 18px 50px rgba(18, 32, 50, .14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(23, 105, 224, .14), transparent 36%),
    linear-gradient(315deg, rgba(20, 135, 90, .12), transparent 42%),
    var(--bg);
}

.login-card {
  width: min(440px, 100%);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin-bottom: 12px;
}

.login-card p {
  color: var(--muted);
  line-height: 1.5;
}

.login-card form,
.login-card label {
  display: grid;
  gap: 10px;
}

.login-card form {
  margin-top: 22px;
}

.login-card label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.login-card input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
}

.login-error {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid #f1b9b9;
  border-radius: 8px;
  background: #fff1f1;
  color: var(--red);
  font-weight: 700;
}

.app-shell {
  padding: 20px;
}

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 34px;
  line-height: 1;
}

.topbar-actions {
  display: flex;
  align-items: end;
  gap: 10px;
}

.logout-form {
  margin: 0;
}

.search {
  display: grid;
  gap: 5px;
  min-width: 310px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

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

.search input:focus,
.field input:focus,
.field select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(23, 105, 224, .15);
}

.ghost-button,
.primary-button,
.danger-button,
.small-button,
.close-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  font-weight: 700;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.primary-button {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.danger-button {
  border-color: rgba(194, 52, 52, .35);
  background: #fff5f5;
  color: var(--red);
}

.small-button {
  padding: 7px 9px;
  font-size: 13px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.summary-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px 15px;
}

.summary-grid span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.summary-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
}

.board {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(260px, 1fr) minmax(340px, 1.35fr) minmax(280px, 1fr) minmax(260px, 1fr);
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 12px;
}

.lane {
  min-width: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #e8edf4;
  padding: 10px;
}

.lane-wide {
  min-width: 340px;
}

.lane header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.lane h2 {
  margin: 0;
  font-size: 16px;
}

.lane header button {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 19px;
  line-height: 1;
}

.cards {
  display: grid;
  gap: 10px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
  box-shadow: 0 1px 0 rgba(18, 32, 50, .04);
  text-align: left;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}

.card:hover {
  border-color: #b9c6d8;
  box-shadow: 0 10px 22px rgba(18, 32, 50, .08);
  transform: translateY(-1px);
}

.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.card-title strong {
  font-size: 16px;
}

.meta {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 3px 8px;
  background: #edf4ff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.pill.green {
  background: #e9f8f0;
  color: var(--green);
}

.pill.red {
  background: #fff0f0;
  color: var(--red);
}

.pill.amber {
  background: #fff7e8;
  color: var(--amber);
}

.slots-preview {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  margin-top: 10px;
}

.slot-dot {
  border-radius: 6px;
  background: #edf1f7;
  color: var(--muted);
  padding: 5px 0;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.slot-dot.filled {
  background: #e9f8f0;
  color: var(--green);
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: none;
}

.drawer.open {
  display: block;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 20, 30, .42);
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(560px, 100%);
  height: 100%;
  overflow: auto;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 20px;
}

.close-button {
  float: right;
  margin-left: 12px;
}

.drawer-title {
  margin: 12px 0 18px;
}

.drawer-title h3 {
  margin: 0 0 8px;
  font-size: 26px;
}

.drawer-section {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-top: 16px;
}

.drawer-section h4 {
  margin: 0 0 12px;
  font-size: 15px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px;
}

.detail span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.detail strong {
  display: block;
  margin-top: 5px;
  word-break: break-word;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.field {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.field-wide {
  grid-column: 1 / -1;
}

.as-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.qr-admin {
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #cfe0f5;
  border-radius: 8px;
  background: #f2f7ff;
}

.qr-admin img {
  width: 116px;
  height: 116px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.qr-admin strong,
.qr-admin span {
  display: block;
}

.qr-admin span {
  margin: 6px 0 10px;
  color: var(--muted);
  font-size: 12px;
  word-break: break-all;
}

.hint-box {
  margin-top: 10px;
  border: 1px solid #cfe0f5;
  border-radius: 8px;
  background: #f2f7ff;
  color: #36536f;
  padding: 10px;
  font-size: 13px;
  line-height: 1.35;
}

.warning-box {
  display: grid;
  gap: 5px;
  margin: 0 0 10px;
  border: 1px solid #f0c36d;
  border-radius: 8px;
  background: #fff8e8;
  color: #6c4700;
  padding: 10px;
  font-size: 13px;
  line-height: 1.35;
}

.warning-box strong {
  color: #563700;
}

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

.slot-list {
  display: grid;
  gap: 8px;
}

.slot-row {
  display: grid;
  grid-template-columns: 74px 1fr auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: var(--surface-soft);
}

.slot-row.slot-conflict {
  border-color: #f0c36d;
  background: #fff8e8;
}

.slot-code {
  font-weight: 700;
}

.slot-actions {
  display: flex;
  gap: 6px;
  white-space: nowrap;
}

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

.thumb {
  width: 100%;
  aspect-ratio: 1024 / 600;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  background: #dfe6ef;
}

.image-preview {
  clear: both;
}

.empty-thumb {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
  object-fit: initial;
}

@media (max-width: 920px) {
  .app-shell {
    padding: 14px;
  }

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

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

  .search {
    min-width: 0;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
