:root {
  color-scheme:light;
  --ink:#15344b;
  --muted:#536d80;
  --paper:#f2f7fb;
  --white:#fff;
  --line:#d5e2eb;
  --blue:#009fe3;
  --blue-dark:#005b8f;
  --yellow:#f59d00;
  --pale:#e5f5fc;
  --danger:#a12c27;
  --shadow:0 10px 28px #123c5a10
}

* {
  box-sizing:border-box
}

body {
  margin:0;
  background:var(--paper);
  color:var(--ink);
  font:16px/1.5 "Trebuchet MS","DejaVu Sans",sans-serif
}

a {
  color:var(--blue-dark);
  text-underline-offset:3px
}

a:hover {
  color:var(--blue)
}

.topbar {
  background:var(--white);
  color:var(--ink);
  border-bottom:4px solid var(--yellow)
}

.nav {
  max-width:1120px;
  margin:auto;
  min-height:88px;
  padding:10px 22px;
  display:flex;
  align-items:center;
  gap:22px;
  flex-wrap:wrap
}

.brand {
  display:flex;
  align-items:center;
  text-decoration:none;
  margin-right:auto
}

.brand-logo {
  display:block;
  width:min(320px,52vw);
  max-height:72px;
  object-fit:contain;
  object-position:left center
}

.nav a:not(.brand) {
  color:var(--blue-dark);
  text-decoration:none;
  font-size:.95rem
}

.nav a:hover {
  color:var(--blue-dark);
  text-decoration:underline
}

.nav form {
  margin:0
}

.nav button {
  background:transparent;
  border:0;
  color:var(--blue-dark);
  padding:4px 0;
  text-decoration:underline;
  text-underline-offset:3px;
  cursor:pointer;
  font:inherit
}

main {
  max-width:1120px;
  margin:34px auto;
  padding:0 22px 52px
}

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

.heading-actions {
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap
}

.eyebrow {
  color:var(--blue-dark);
  font-size:.77rem;
  font-weight:750;
  text-transform:uppercase
}

.heading h1 {
  font-size:2.2rem;
  line-height:1.1;
  margin:5px 0 0
}

.heading p {
  margin:7px 0 0;
  color:var(--muted)
}

.button {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:42px;
  border:1px solid var(--blue);
  border-radius:4px;
  background:var(--blue);
  color:white;
  padding:9px 15px;
  font:inherit;
  font-weight:650;
  text-decoration:none;
  cursor:pointer
}

.button:hover {
  background:var(--blue-dark);
  color:#fff
}

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

.button.danger {
  background:var(--yellow);
  border-color:var(--yellow);
  color:var(--ink)
}

.button.small {
  min-height:34px;
  padding:5px 10px;
  font-size:.9rem
}

.icon-button {
  width:36px;
  min-width:36px;
  padding:4px;
  font-size:1.2rem
}

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

.stats {
  display:grid;
  grid-template-columns:repeat(7,minmax(0,1fr));
  gap:14px;
  margin:22px 0 30px
}

.stat {
  background:var(--white);
  border:1px solid var(--line);
  border-top:3px solid var(--blue);
  padding:16px 18px;
  box-shadow:var(--shadow)
}

.stat span {
  display:block;
  color:var(--muted);
  font-size:.9rem
}

.stat strong {
  font-size:1.8rem;
  line-height:1.2
}

.toolbar {
  display:flex;
  gap:10px;
  align-items:end;
  flex-wrap:wrap;
  margin:0 0 16px
}

.toolbar-search {
  flex:1;
  min-width:220px
}

.field {
  display:grid;
  gap:6px;
  min-width:0
}

.field label {
  font-size:.91rem;
  font-weight:650
}

.field input,.field select,.field textarea {
  width:100%;
  border:1px solid #aebbb2;
  border-radius:4px;
  background:#fff;
  color:var(--ink);
  font:inherit;
  padding:10px 11px
}

.inventory-number-input {
  display:flex;
  align-items:stretch
}

.inventory-number-input span {
  display:flex;
  align-items:center;
  padding:0 12px;
  border:1px solid #aebbb2;
  border-right:0;
  border-radius:4px 0 0 4px;
  background:#e5f2f8;
  color:var(--blue-dark);
  font-weight:700
}

.inventory-number-input input {
  border-radius:0 4px 4px 0
}

.field input:focus,.field select:focus,.field textarea:focus {
  outline:3px solid #006b5033;
  border-color:var(--green)
}

.field textarea {
  min-height:96px;
  resize:vertical
}

.field small {
  color:var(--muted)
}

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

.form-grid .wide {
  grid-column:1/-1
}

.form-actions {
  display:flex;
  gap:10px;
  align-items:center;
  margin-top:20px
}

.form-shell {
  max-width:760px;
  background:#fff;
  padding:22px;
  border:1px solid var(--line);
  box-shadow:var(--shadow)
}

.form-note {
  max-width:760px;
  margin:0 0 16px;
  padding:12px 14px;
  border-left:4px solid var(--blue);
  background:var(--pale);
  color:var(--blue-dark)
}

.counter-panel {
  margin-bottom:20px
}

.danger-zone {
  margin-top:22px;
  padding-top:16px;
  border-top:1px solid var(--line)
}

.counter-panel h2 {
  margin:0
}

.counter-heading {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px
}

.counter-panel > p {
  margin:0 0 12px
}

.counter-table-wrap {
  border:0;
  box-shadow:none
}

.counter-table-wrap table {
  min-width:0
}

.counter-value {
  text-align:right;
  color:var(--muted);
  font-size:.88rem;
  font-variant-numeric:tabular-nums
}

.counter-edit-table {
  overflow-x:auto
}

.counter-edit-table table {
  width:100%;
  min-width:0
}

.counter-edit-table td:last-child {
  text-align:right
}

.counter-edit-table input {
  width:min(100%,240px);
  border:1px solid #aebbb2;
  border-radius:4px;
  padding:8px 10px;
  font:inherit
}

#counter-adjustment[hidden] {
  display:none
}

.table-wrap {
  overflow-x:auto;
  background:#fff;
  border:1px solid var(--line);
  box-shadow:var(--shadow)
}

table {
  width:100%;
  border-collapse:collapse;
  min-width:620px
}

th,td {
  text-align:left;
  padding:12px 14px;
  border-bottom:1px solid var(--line);
  vertical-align:top
}

th {
  background:#e5f2f8;
  color:var(--blue-dark);
  font-size:.84rem;
  text-transform:uppercase
}

tr:last-child td {
  border-bottom:0
}

.muted {
  color:var(--muted)
}

.status {
  display:inline-block;
  padding:3px 8px;
  border-radius:3px;
  background:var(--pale);
  color:var(--blue-dark);
  font-size:.84rem;
  font-weight:700
}

.status.issued {
  background:#fff2d6;
  color:#765000
}

.status.retired {
  background:#fbe9e6;
  color:var(--danger)
}

.empty {
  padding:24px;
  color:var(--muted);
  background:#fff;
  border:1px dashed #b6c3b9
}

.flash-list {
  display:grid;
  gap:8px;
  margin:0 0 18px
}

.flash {
  padding:10px 13px;
  border-left:4px solid var(--blue);
  background:var(--pale)
}

.flash.error {
  border-color:var(--danger);
  background:#fbe9e6
}

.flash.warning {
  border-color:var(--yellow);
  background:#fff2d6
}

.detail-grid {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:20px
}

.panel {
  background:#fff;
  border:1px solid var(--line);
  padding:18px;
  box-shadow:var(--shadow)
}

.panel h2 {
  font-size:1.12rem;
  margin:0 0 14px
}

.history-panel {
  margin-top:20px
}

.facts {
  display:grid;
  grid-template-columns:minmax(110px,.4fr) 1fr;
  gap:8px 14px;
  margin:0
}

.facts dt {
  color:var(--muted)
}

.facts dd {
  margin:0;
  overflow-wrap:anywhere
}

.history {
  display:grid;
  gap:0
}

.history-item {
  padding:12px 0;
  border-top:1px solid var(--line)
}

.history-item:first-child {
  border-top:0;
  padding-top:0
}

.inline-form {
  display:flex;
  align-items:end;
  gap:9px;
  flex-wrap:wrap
}

.inline-form .field {
  flex:1;
  min-width:150px
}

.item-disposition-form {
  display:flex;
  align-items:end;
  gap:10px;
  flex-wrap:wrap;
  margin-top:18px;
  padding-top:16px;
  border-top:1px solid var(--line)
}

.item-disposition-form .field {
  flex:1;
  min-width:180px
}

.inventory-controls {
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(150px,.55fr);
  gap:12px
}

.inventory-count {
  margin:12px 0 6px;
  font-size:.9rem
}

.inventory-picker {
  display:grid
}

.inventory-choice {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:10px 0;
  border-top:1px solid var(--line)
}

.inventory-choice[hidden] {
  display:none
}

.inventory-choice-info {
  display:grid;
  min-width:0
}

.inventory-choice-info span {
  color:var(--muted);
  font-size:.9rem
}

.inventory-issue-form {
  margin:0;
  flex:none
}

.wurfware-issue {
  margin-top:22px;
  padding-top:18px;
  border-top:1px solid var(--line)
}

.wurfware-issue h3 {
  margin:0 0 12px;
  font-size:1rem
}

.inventory-empty {
  margin-top:10px
}

.visually-hidden {
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap;
  border:0
}

.field-spaced {
  margin-top:12px
}

.check {
  display:flex;
  gap:9px;
  align-items:center
}

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

.login-wrap {
  max-width:420px;
  margin:7vh auto
}

.login-wrap .form-shell {
  padding:26px
}

.login-wrap h1 {
  margin-top:0
}

.footer {
  max-width:1120px;
  padding:0 22px 25px;
  margin:auto;
  color:var(--muted);
  font-size:.84rem
}

.nav-links {
  display:flex;
  align-items:center;
  gap:22px;
  flex-wrap:wrap
}

@media(max-width:1024px) {
  main {
    margin-top:26px;
    padding-inline:18px
  }

  .stats {
    grid-template-columns:repeat(auto-fit,minmax(150px,1fr))
  }

  .detail-grid {
    grid-template-columns:1fr
  }

  .button,.field input,.field select,.field textarea {
    min-height:44px
  }

  .button.small {
    min-height:40px
  }

  .icon-button {
    width:44px;
    min-width:44px
  }
}

@media(max-width:700px) {
  body {
    font-size:15px
  }

  .nav {
    gap:10px;
    min-height:0;
    padding:10px 15px
  }

  .brand {
    width:100%;
    margin-bottom:2px
  }

  .brand-logo {
    width:min(260px,76vw)
  }

  .nav-links {
    width:100%;
    gap:4px 18px;
    border-top:1px solid var(--line);
    padding-top:6px
  }

  .nav-links a,.nav button {
    display:inline-flex;
    align-items:center;
    min-height:44px
  }

  .heading {
    flex-direction:column;
    align-items:stretch;
    gap:14px
  }

  .heading h1 {
    font-size:1.7rem
  }

  .heading-actions {
    width:100%;
    align-items:stretch
  }

  .heading-actions .button {
    flex:1
  }

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

  .stat {
    padding:12px 14px
  }

  .form-grid,.detail-grid,.inventory-controls {
    grid-template-columns:1fr
  }

  .form-grid .wide {
    grid-column:auto
  }

  .form-shell {
    padding:16px
  }

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

  .toolbar .button {
    width:100%
  }

  .inventory-choice {
    align-items:flex-start
  }

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

  .item-disposition-form {
    flex-direction:column;
    align-items:stretch
  }

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

  main {
    margin-top:20px;
    padding-inline:15px
  }

  .footer {
    padding-inline:15px
  }

  .table-wrap {
    background:transparent;
    border:0;
    box-shadow:none;
    overflow-x:visible
  }

  table {
    min-width:0
  }

  table thead {
    position:absolute;
    width:1px;
    height:1px;
    overflow:hidden;
    clip:rect(0,0,0,0)
  }

  table,table tbody,table tr,table td {
    display:block;
    width:100%
  }

  table tr {
    margin-bottom:12px;
    background:#fff;
    border:1px solid var(--line);
    border-top:3px solid var(--blue);
    box-shadow:var(--shadow)
  }

  table td {
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:14px;
    padding:9px 14px;
    text-align:right;
    border-bottom:1px solid var(--line)
  }

  table td:last-child {
    border-bottom:0
  }

  table td::before {
    content:attr(data-label);
    flex:none;
    max-width:45%;
    color:var(--muted);
    font-size:.78rem;
    font-weight:700;
    text-align:left;
    text-transform:uppercase
  }

  table td[data-label=""]::before,table td:not([data-label])::before {
    content:none
  }

  table td .row-actions,table td .inline-form {
    justify-content:flex-end
  }

  table td form.inline-form {
    width:100%
  }

  .counter-table-wrap table tr,.counter-edit-table table tr {
    box-shadow:none
  }

  .counter-edit-table td:last-child {
    text-align:right
  }

  .counter-edit-table input {
    width:100%
  }
}

@media(max-width:420px) {
  .stat span {
    font-size:.8rem
  }

  .stat strong {
    font-size:1.5rem
  }

  .heading h1 {
    font-size:1.5rem
  }

  .heading-actions .button {
    flex-basis:100%
  }

  .row-actions .button:not(.icon-button) {
    flex:1
  }
}
