/* Inventory and admin screens. The page frame and menu are in layout.css. */
.inline { display: inline; }
.muted { color: var(--muted); font-size: .9rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 1rem; margin-bottom: 1rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.spread { justify-content: space-between; }


label { display: block; font-weight: 600; font-size: .9rem; margin: .6rem 0 .2rem; }
input, select, textarea { font: inherit; padding: .5rem; border: 1px solid var(--line); border-radius: 6px; background: #fff; width: 100%; }
input[type=checkbox] { width: auto; transform: scale(1.3); margin-right: .4rem; }
.check { display: flex; align-items: center; font-weight: 400; }
.form-grid { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
button, .button { display: inline-block; font: inherit; font-weight: 600; padding: .55rem 1rem; border-radius: 6px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-text); cursor: pointer; text-decoration: none; }
button.secondary, .button.secondary { background: #fff; color: var(--accent); }
button.danger { background: #fff; color: var(--bad); border-color: var(--bad); }
button.link { background: none; border: 0; padding: 0; font-weight: 400; text-decoration: underline; }
button.small, .button.small { padding: .3rem .6rem; font-size: .85rem; }

table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
td.num, th.num { text-align: right; }
.table-wrap { overflow-x: auto; }

.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: #eee; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }

/* Count sheet & check-in: one card per item so it works on a phone */
.sheet-section { margin-bottom: 1.2rem; }
.sheet-section > summary, .sheet-section > h2 { position: sticky; top: 0; z-index: 1; background: var(--bg); padding: .5rem 0;
  font-weight: 700; font-size: 1.1rem; margin: 0; cursor: pointer; }
.line { display: grid; grid-template-columns: 1fr auto; gap: .3rem .8rem; align-items: center; background: var(--card);
  border: 1px solid var(--line); border-radius: 8px; padding: .6rem .8rem; margin-bottom: .4rem; }
.line.done { border-left: 5px solid var(--ok); }
.line.problem { border-left: 5px solid var(--bad); }
.line .desc { font-weight: 600; }
.line .meta { color: var(--muted); font-size: .85rem; }
.qty-inputs { display: flex; gap: .4rem; align-items: center; }
.qty-inputs input { width: 5.2rem; text-align: right; font-size: 1.1rem; }
.qty-inputs span { font-size: .8rem; color: var(--muted); }
.line-more { grid-column: 1 / -1; }
.line-details { display: grid; margin-top: .4rem; gap: .4rem .8rem; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.line-details label { margin: 0; font-size: .8rem; }
.savebar { position: sticky; bottom: 0; background: var(--card); border-top: 1px solid var(--line); padding: .6rem 1rem;
  margin: 0 -1rem; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; z-index: 2; }
.total { font-size: 1.2rem; font-weight: 700; }

@media (max-width: 600px) {
  body > main { padding: .9rem .75rem 1.5rem; }
  .savebar { margin: 0 -.6rem; }
  .hide-sm { display: none; }
}
@media print {
  .sidenav, .mobilebar, .savebar, form button, .no-print { display: none !important; }
  body.has-nav > main { margin-left: 0; }
  body { background: #fff; }
  .card { border: 0; padding: 0; }
}

/* Drag-and-drop ordering (layout pages) */
.sortable { list-style: none; margin: 0; padding: 0; }
.sort-item { display: flex; align-items: center; gap: .6rem; background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; padding: .5rem .6rem; margin-bottom: .35rem; }
.sort-item .grow { flex: 1; min-width: 0; }
.handle { cursor: grab; touch-action: none; user-select: none; font-size: 1.5rem; line-height: 1; padding: .3rem .4rem;
  color: var(--muted); border-radius: 6px; }
.handle:hover { background: var(--bg); color: var(--text); }
.sort-item.dragging { opacity: .9; border-color: var(--accent); box-shadow: 0 4px 14px rgba(0,0,0,.18); position: relative; z-index: 3; }
body.is-sorting, body.is-sorting * { cursor: grabbing !important; user-select: none; }
@media (max-width: 600px) { .sort-item { flex-wrap: wrap; } .sort-item .grow { flex-basis: calc(100% - 8rem); } }
.count-setup { display: flex; flex-wrap: wrap; gap: .3rem .8rem; margin-top: .3rem; }
.count-setup label { display: flex; align-items: center; gap: .35rem; margin: 0; font-weight: 400; font-size: .85rem; }
.count-setup select { width: auto; padding: .25rem .4rem; }
.count-setup input { width: 4.5rem; padding: .25rem .4rem; text-align: right; }

/* Item pictures */
.item-pic { flex: none; display: inline-block; border-radius: 6px; background: #fff; border: 1px solid var(--line);
  object-fit: contain; vertical-align: middle; }
.item-pic.none { background: var(--bg); border-style: dashed; }
.item-cell { display: flex; align-items: center; gap: .6rem; }
.item-cell > div { min-width: 0; }
.line .item-cell { gap: .7rem; }

/* Users: store checkboxes */
.store-checks { display: flex; flex-wrap: wrap; gap: .2rem 1rem; }
.store-checks .check { margin: 0; white-space: nowrap; font-weight: 400; }
tr.readonly td { color: var(--muted); }
.table-wrap td select { min-width: 9.5rem; }
.table-wrap td input[name=display_name], .table-wrap td input[name=new_password] { min-width: 9rem; }

/* Sign-in / 2FA screens */
.card.narrow { max-width: 460px; margin: 2rem auto; }
.code-input { font-size: 1.6rem; letter-spacing: .25em; text-align: center; max-width: 12rem; font-variant-numeric: tabular-nums; }
.code-input.small { font-size: 1.1rem; max-width: 8rem; }
.qr { margin: .6rem 0; }
.qr svg { width: 200px; height: 200px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.secret { word-break: break-all; font-size: 1rem; }
.steps { padding-left: 1.2rem; } .steps li { margin-bottom: .6rem; }
.backup-codes { columns: 2; font-size: 1.1rem; padding-left: 1.5rem; } .backup-codes li { margin: .2rem 0; }
.setup-link { display: flex; gap: .5rem; } .setup-link input { font-family: monospace; font-size: .85rem; }
.user-actions { display: flex; flex-wrap: wrap; gap: .1rem .8rem; margin-top: .3rem; }
.user-actions .link { font-size: .85rem; color: var(--accent); }

main button.link { color: var(--accent); }

/* Item photo upload */
.item-head { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1rem; }
.file-btn { position: relative; overflow: hidden; cursor: pointer; }
.file-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
@media (max-width: 600px) { .item-head .item-pic { width: 84px !important; height: 84px !important; } }

/* Home: module cards */
.module-card { display: block; color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.module-card:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.module-card h2 { margin-top: 0; color: var(--accent); }
.access-label { margin-top: .5rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
