:root {
  color-scheme: light;
  font-family: Inter, "Yu Gothic UI", "Meiryo", sans-serif;
  color: #17212b;
  background: #f4f6f8;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
button, input { font: inherit; }
button {
  border: 1px solid #1d4d67;
  border-radius: 8px;
  background: #1d4d67;
  color: white;
  padding: 10px 14px;
  cursor: pointer;
}
button:disabled { opacity: .55; cursor: wait; }
button:hover:not(:disabled) { filter: brightness(.94); }
input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 11px;
  border: 1px solid #bec8d0;
  border-radius: 7px;
  background: white;
  color: #17212b;
}
input:focus { outline: 2px solid #85b8d2; outline-offset: 1px; }
label { display: block; font-size: 14px; font-weight: 600; }
h1 { margin: 4px 0 0; font-size: 26px; }
h2 { margin: 0 0 16px; font-size: 20px; }
h3 { margin: 0 0 12px; font-size: 16px; }
p { line-height: 1.5; }
.page-shell { max-width: 1120px; margin: 0 auto; padding: 32px 28px 24px; }
.app-header, .section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.app-header { margin-bottom: 22px; }
.eyebrow { margin: 0; color: #587080; font-size: 11px; font-weight: 700; letter-spacing: .12em; }
.status-pill {
  border: 1px solid #c8d3da;
  border-radius: 20px;
  padding: 6px 11px;
  color: #526672;
  background: #fff;
  font-size: 12px;
}
.panel {
  margin: 16px 0;
  padding: 24px;
  border: 1px solid #d7dfe4;
  border-radius: 12px;
  background: white;
  box-shadow: 0 3px 12px rgb(22 42 58 / 4%);
}
.hidden { display: none !important; }
.auth-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.auth-grid .panel { margin: 0; }
.stack-form { display: grid; gap: 14px; }
.narrow-form { max-width: 480px; }
.help-text { color: #61717c; font-size: 13px; margin: 8px 0 14px; }
.button-secondary { color: #1d4d67; background: #eef5f8; border-color: #b9ccd6; }
.button-quiet { color: #455762; background: white; border-color: #c8d2d9; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; }
.root-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.record-list { display: grid; gap: 9px; }
.record-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 12px; border: 1px solid #e0e6ea; border-radius: 8px;
}
.record-copy { min-width: 0; overflow-wrap: anywhere; }
.record-copy strong { display: block; font-size: 14px; }
.record-copy small { color: #647681; font-size: 12px; }
.record-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.record-actions button { padding: 7px 10px; font-size: 12px; }
.record-actions .danger { color: #9d312c; background: #fff5f4; border-color: #e6c4c1; }
.message { min-height: 1.2em; margin: 8px 0; color: #315b3b; font-size: 13px; white-space: pre-wrap; }
.message.error { color: #a02e29; }
.app-footer {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-top: 28px; color: #77858e; font-size: 11px;
}
@media (max-width: 760px) {
  .page-shell { padding: 22px 16px; }
  .auth-grid, .root-columns { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .record-row { align-items: flex-start; flex-direction: column; }
}


.material-admin {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border, #d8dee6);
}

.materials-import {
  display: grid;
  grid-template-columns: minmax(12rem, 0.45fr) minmax(16rem, 1fr);
  gap: 0.75rem;
  align-items: stretch;
}

.materials-drop-zone {
  min-height: 3.25rem;
  border: 1px dashed #8796a8;
  border-radius: 0.5rem;
  background: #f7f9fb;
  color: #344256;
  cursor: pointer;
}

.materials-drop-zone.drag-over {
  border-color: #2762a5;
  background: #edf5ff;
}

.materials-toolbar {
  align-items: center;
  margin-bottom: 0;
}

.materials-table-wrap {
  max-height: 55vh;
  overflow: auto;
  border: 1px solid var(--border, #d8dee6);
  border-radius: 0.5rem;
}

.materials-table {
  width: 100%;
  min-width: 58rem;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
}

.materials-table th,
.materials-table td {
  padding: 0.35rem;
  border-bottom: 1px solid #e3e7ed;
  border-right: 1px solid #e3e7ed;
  text-align: left;
  vertical-align: middle;
}

.materials-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f1f4f7;
  white-space: nowrap;
}

.materials-table td input {
  width: 100%;
  min-width: 5rem;
  padding: 0.4rem;
  border: 1px solid transparent;
  border-radius: 0.25rem;
  background: transparent;
}

.materials-table td input:focus {
  border-color: #2762a5;
  outline: 2px solid #d7e8fb;
  background: #fff;
}

.materials-errors {
  margin: 0;
  padding: 0.75rem 0.75rem 0.75rem 2.25rem;
  border: 1px solid #c94b4b;
  border-radius: 0.4rem;
  color: #9b2424;
  background: #fff7f7;
}

.materials-errors[hidden] {
  display: none;
}

@media (max-width: 760px) {
  .materials-import {
    grid-template-columns: 1fr;
  }
  .materials-toolbar {
    align-items: flex-start;
  }
}
