:root {
  color-scheme: light;
  --brand: #2c2276;
  --blue: #405eb5;
  --ink: #292832;
  --muted: #656571;
  --line: #e5e6eb;
  font-family: "Albert Sans", Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: #f7f8fb; font-size: 15px; line-height: 1.5; }
body, button, input, select { font-family: "Albert Sans", Arial, sans-serif; }
button, label { cursor: pointer; }
a { color: inherit; }
.skip-link { position: absolute; z-index: 5; top: 8px; left: 8px; transform: translateY(-150%); padding: 10px 14px; color: #fff; background: var(--brand); }
.skip-link:focus { transform: translateY(0); }
.admin-header { display: flex; min-height: 74px; align-items: center; justify-content: space-between; gap: 20px; padding: 10px max(24px, calc((100% - 1120px) / 2)); background: var(--brand); }
.admin-header img { display: block; width: 70px; height: 44px; object-fit: contain; }
.admin-header nav { display: flex; flex-wrap: wrap; gap: 20px; }
.admin-header nav a { color: #fff; font-size: 14px; text-decoration: none; }
.admin-header nav a:hover { text-decoration: underline; }
.admin-main { width: min(1120px, calc(100% - 40px)); min-height: calc(100vh - 138px); margin: 0 auto; padding: 42px 0 64px; }
.page-heading { margin-bottom: 24px; }
.eyebrow { margin: 0 0 5px; color: var(--blue); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
.page-heading h1 { margin-bottom: 8px; color: var(--brand); font-size: clamp(28px, 4vw, 36px); line-height: 1.2; }
.page-heading > p:last-child { margin-bottom: 0; color: var(--muted); }
.notice { margin-bottom: 24px; padding: 16px 18px; border: 1px solid #e8d59b; border-radius: 6px; color: #584817; background: #fff8df; font-size: 13px; }
.notice strong { display: block; margin-bottom: 3px; }
.panel-card, .records-section { padding: 24px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 2px 8px rgba(32, 35, 67, .04); }
.panel-card h2, .records-heading h2 { margin-bottom: 18px; color: var(--brand); font-size: 21px; }
#record-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
#record-form label { display: grid; gap: 7px; color: #3a3944; font-size: 13px; font-weight: 600; }
#record-form input, #record-form select { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #cfd2dc; border-radius: 4px; color: var(--ink); background: #fff; font-size: 14px; }
#record-form input:focus, #record-form select:focus, button:focus-visible, a:focus-visible, .import-button:focus-within { outline: 3px solid rgba(64, 94, 181, .28); outline-offset: 2px; }
.code-field { grid-column: 1 / -1; }
.code-field span { color: var(--muted); font-size: 12px; font-weight: 400; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; padding: 9px 15px; border: 1px solid transparent; border-radius: 4px; font-size: 13px; font-weight: 600; text-decoration: none; }
.button-primary { color: #fff; background: var(--blue); }
.button-primary:hover { background: #354e9b; }
.button-secondary { border-color: #cfd2dc; color: #373643; background: #fff; }
.button-secondary:hover { background: #f1f2f7; }
.message { min-height: 21px; margin: 10px 0 0; color: #295b38; font-size: 13px; }
.message.error { color: #a32727; }
.records-section { margin-top: 24px; }
.records-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.records-heading h2 { margin-bottom: 2px; }
.records-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
.import-button { cursor: pointer; }
.visually-hidden { position: fixed; top: 0; left: 0; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: 12px; font-weight: 600; }
td { font-size: 13px; }
.product-name { display: block; font-weight: 700; }
.lot-name { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.code-value { max-width: 240px; overflow-wrap: anywhere; font-family: Consolas, monospace; font-size: 12px; }
.status { display: inline-block; padding: 4px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.status-active { color: #22623a; background: #e4f4e9; }
.status-inactive { color: #565761; background: #ececf0; }
.status-blocked { color: #9c2828; background: #fde7e7; }
.status-cell select { display: block; max-width: 130px; margin-top: 7px; padding: 5px 7px; border: 1px solid #cfd2dc; border-radius: 4px; color: var(--ink); background: #fff; font-size: 12px; }
.qr-cell { min-width: 112px; }
.qr-cell canvas { display: block; width: 96px; height: 96px; image-rendering: pixelated; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.row-actions button { padding: 6px 8px; border: 1px solid #cfd2dc; border-radius: 4px; color: #373643; background: #fff; font-size: 12px; }
.row-actions button:hover { background: #f1f2f7; }
.row-actions .delete-button { border-color: #e5c4c4; color: #9c2828; }
.empty-state { margin: 0; padding: 30px 12px; color: var(--muted); text-align: center; }
.empty-state[hidden] { display: none; }
.admin-footer { display: flex; justify-content: space-between; gap: 20px; padding: 18px max(24px, calc((100% - 1120px) / 2)); border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.admin-footer a { color: var(--brand); text-decoration: none; }

@media (max-width: 700px) {
  .admin-header { padding-inline: 20px; }
  .admin-header nav { justify-content: flex-end; gap: 8px 14px; }
  .admin-main { width: min(100% - 28px, 1120px); padding-top: 30px; }
  .panel-card, .records-section { padding: 18px 14px; }
  .records-heading { align-items: flex-start; flex-direction: column; }
  .admin-footer { flex-direction: column; align-items: center; gap: 6px; }
}

@media (max-width: 480px) {
  .admin-header { align-items: flex-start; }
  .admin-header nav { flex-direction: column; gap: 4px; padding-top: 4px; }
  #record-form { grid-template-columns: 1fr; }
  .code-field { grid-column: auto; }
}
