/* Home Inventory — single hand-written stylesheet. Mobile-first. */

:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1c2430;
  --muted: #67707e;
  --line: #dfe3e8;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --danger: #dc2626;
  --ok-bg: #ecfdf5;
  --ok-text: #065f46;
  --err-bg: #fef2f2;
  --err-text: #991b1b;
  --warn-bg: #fffbeb;
  --warn-text: #92400e;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --card: #1b2129;
    --text: #e5e9ef;
    --muted: #96a0ad;
    --line: #2c3542;
    --accent: #3b82f6;
    --accent-dark: #60a5fa;
    --ok-bg: #06281e;
    --ok-text: #6ee7b7;
    --err-bg: #2b1214;
    --err-text: #fca5a5;
    --warn-bg: #2a2108;
    --warn-text: #fcd34d;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

h1, h2, h3 { line-height: 1.25; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

small, .muted { color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.2em 0; }

code, .codeblock {
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: .9em;
  background: var(--bg);
  border-radius: 4px;
  padding: .1em .35em;
}
.codeblock {
  display: block;
  padding: .8em 1em;
  overflow-x: auto;
  border: 1px solid var(--line);
  white-space: pre-wrap;
  word-break: break-all;
}

/* ---- Nav ---- */
.topnav {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .25rem;
  padding: .45rem .9rem;
  position: sticky;
  top: 0;
  z-index: 50;
}
.brand { font-weight: 700; font-size: 1.05rem; color: var(--text); margin-right: auto; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.navtoggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 1.2rem;
  color: var(--text);
  padding: .1rem .55rem;
  cursor: pointer;
}
.navlinks { display: flex; align-items: center; gap: .2rem; flex-wrap: wrap; }
.navlinks a {
  color: var(--text);
  padding: .35rem .6rem;
  border-radius: 6px;
  white-space: nowrap;
}
.navlinks a:hover { background: var(--bg); text-decoration: none; }
.pill {
  background: var(--danger);
  color: #fff;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  padding: .05rem .45rem;
  vertical-align: middle;
}
@media (max-width: 860px) {
  .navtoggle { display: block; }
  .navlinks { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; padding-top: .4rem; }
  body.nav-open .navlinks { display: flex; }
  .navlinks a { padding: .6rem .6rem; border-top: 1px solid var(--line); border-radius: 0; }
}

/* ---- Layout ---- */
.container { max-width: 1000px; margin: 0 auto; padding: 1rem; }
.container.wide { max-width: 1280px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.2rem;
  margin-bottom: 1rem;
}

.page-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; margin: .3rem 0 .9rem; }
.page-head h1 { margin: 0; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---- Flash ---- */
.flash { border-radius: 8px; padding: .6rem .9rem; margin-bottom: .8rem; }
.flash-success { background: var(--ok-bg); color: var(--ok-text); }
.flash-error { background: var(--err-bg); color: var(--err-text); }
.flash-warning { background: var(--warn-bg); color: var(--warn-text); }

/* ---- Forms ---- */
label { display: block; margin-bottom: .8rem; font-weight: 600; font-size: .92rem; }
label input, label select, label textarea { margin-top: .25rem; font-weight: 400; }
input[type=text], input[type=password], input[type=number], input[type=url], input[type=email],
input[type=date], input[type=search], select, textarea {
  width: 100%;
  padding: .55rem .7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
textarea { min-height: 90px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 1rem; }
@media (max-width: 640px) { .form-grid, .form-grid-3 { grid-template-columns: 1fr; } }
.inline-form { display: inline; }

/* ---- Buttons ---- */
.btn {
  display: inline-block;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  border-radius: 8px;
  padding: .5rem .95rem;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}
.btn:hover { background: var(--bg); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-danger:hover { background: var(--err-bg); }
.btn-sm { padding: .25rem .6rem; font-size: .85rem; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-big { font-size: 1.15rem; padding: .9rem 1.4rem; }

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

/* ---- Item/container grids ---- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .8rem;
}
.tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  color: var(--text);
}
.tile:hover { text-decoration: none; border-color: var(--accent); }
.tile .thumb {
  aspect-ratio: 4 / 3;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  overflow: hidden;
}
.tile .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .tile-body { padding: .5rem .6rem .6rem; }
.tile .tile-title { font-weight: 600; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tile .tile-sub { font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.thumb-sm { width: 52px; height: 52px; object-fit: cover; border-radius: 6px; background: var(--bg); display: block; }

.badge {
  display: inline-block;
  font-size: .75rem;
  font-weight: 600;
  border-radius: 999px;
  padding: .1rem .55rem;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.badge-pending { background: var(--warn-bg); color: var(--warn-text); border-color: transparent; }

.breadcrumb { font-size: .9rem; color: var(--muted); margin-bottom: .6rem; }
.breadcrumb a { color: var(--muted); }

/* ---- Stats (dashboard) ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: .8rem 1rem; }
.stat .stat-num { font-size: 1.6rem; font-weight: 700; }
.stat .stat-label { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

.searchbar { display: flex; gap: .5rem; margin-bottom: 1rem; }
.searchbar input { font-size: 1.05rem; }

/* ---- Photo manager ---- */
.photo-strip { display: flex; flex-wrap: wrap; gap: .7rem; }
.photo-card { width: 130px; text-align: center; }
.photo-card img { width: 130px; height: 100px; object-fit: cover; border-radius: 8px; border: 2px solid var(--line); display: block; }
.photo-card.primary img { border-color: var(--accent); }
.photo-card .photo-actions { display: flex; justify-content: center; gap: .3rem; margin-top: .25rem; }

/* ---- Speed save ---- */
.speed-wrap { text-align: center; padding: 1.5rem 0; }
.speed-count { font-size: 3.2rem; font-weight: 800; }
.speed-status { min-height: 1.5em; }
.speed-thumbs { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin-top: 1rem; }
.speed-thumbs img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; }

/* ---- Triage ---- */
.triage-photo { text-align: center; margin-bottom: 1rem; }
.triage-photo img { max-width: 100%; max-height: 45vh; border-radius: var(--radius); }

/* ---- Batch editor ---- */
.batch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.batch-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px 8px 0 0; }
.batch-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.batch-card .batch-fields { padding: .6rem; }
.batch-card input, .batch-card select { margin-bottom: .4rem; font-size: .9rem; padding: .4rem .5rem; }

/* ---- Installer ---- */
.installer { max-width: 640px; }
.wizard-steps { display: flex; gap: .3rem; list-style: none; padding: 0; margin: 0 0 1rem; flex-wrap: wrap; justify-content: center; }
.wizard-steps li { font-size: .8rem; padding: .25rem .7rem; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--muted); }
.wizard-steps li.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.wizard-steps li.done { color: var(--ok-text); background: var(--ok-bg); border-color: transparent; }

/* ---- Login ---- */
.login-wrap { display: flex; justify-content: center; padding-top: 8vh; }
.login-card { width: 100%; max-width: 380px; }
.login-title { text-align: center; }

/* ---- QR blocks on screen ---- */
.qr-box { width: 140px; }
.qr-box svg { width: 100%; height: auto; display: block; }

/* ---- Checkbox rows (labels page, move mode) ---- */
.check-row { display: flex; align-items: center; gap: .5rem; padding: .35rem 0; border-bottom: 1px solid var(--line); font-weight: 400; margin: 0; }
.check-row input[type=checkbox] { width: 1.1rem; height: 1.1rem; }

/* ---- Print ---- */
@media print {
  .topnav, .no-print, .flash { display: none !important; }
  body { background: #fff; color: #000; }
  .container { max-width: none; padding: 0; }
  .card { border: 0; box-shadow: none; }
}
