:root {
  --ink: #17202a;
  --muted: #6a7480;
  --line: #dce2e8;
  --panel: #ffffff;
  --page: #f3f6f8;
  --brand: #1d4ed8;
  --brand-strong: #173a9a;
  --accent: #0f9f8f;
  --warn: #d97706;
  --danger: #b42318;
  --good: #15803d;
  --header: #101828;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  text-decoration: none;
}

.app-header {
  background: var(--header);
  border-bottom: 1px solid rgba(255,255,255,.12);
}

.navbar {
  min-height: 66px;
}

.brand-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.app-main {
  padding: 18px;
  max-width: 1480px;
  margin: 0 auto;
}

.auth-main {
  min-height: 100vh;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: radial-gradient(circle at top left, rgba(15,159,143,.18), transparent 32%), #111827;
}

.login-card {
  width: min(440px, 100%);
  background: #fff;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,.28);
}

.login-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  background: #101828;
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 18px;
}

.eyebrow {
  color: var(--accent);
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.stack {
  display: grid;
  gap: 12px;
}

.page-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
}

.page-title h1 {
  font-size: clamp(1.55rem, 2.4vw, 2.2rem);
  margin: 0;
  font-weight: 800;
}

.page-title p {
  color: var(--muted);
  margin: 4px 0 0;
}

.grid {
  display: grid;
  gap: 14px;
}

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

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 6px 18px rgba(16,24,40,.04);
}

.stat {
  min-height: 112px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stat-label {
  color: var(--muted);
  font-size: .82rem;
  font-weight: 700;
}

.stat-value {
  font-size: 2rem;
  font-weight: 850;
}

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

.btn,
.form-control,
.form-select {
  min-height: 44px;
  border-radius: 8px;
}

.btn-sm {
  min-height: 36px;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.scan-button {
  min-height: 58px;
  font-size: 1.1rem;
  font-weight: 800;
}

.scan-input {
  min-height: 58px;
  font-size: 1.22rem;
  font-weight: 700;
}

.badge-status {
  border-radius: 999px;
  padding: .42rem .66rem;
  font-weight: 800;
  font-size: .74rem;
}

.status-active,
.status-in_progress {
  background: #dbeafe;
  color: #1e3a8a;
}

.status-draft {
  background: #eef2f7;
  color: #475467;
}

.status-ready_for_review {
  background: #fef3c7;
  color: #92400e;
}

.status-finished,
.status-locked,
.status-done {
  background: #dcfce7;
  color: #166534;
}

.status-open {
  background: #e0f2fe;
  color: #075985;
}

.reminder {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #f8fbff;
  border: 1px solid #c8d9f2;
  border-left: 4px solid var(--brand);
  color: #243b5a;
  border-radius: 8px;
  padding: 12px 14px;
}

.locked-banner {
  background: #fff1f0;
  border: 1px solid #fecaca;
  color: #991b1b;
  border-radius: 8px;
  padding: 12px 14px;
  font-weight: 750;
}

.table-responsive {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.table {
  margin-bottom: 0;
}

.task-card,
.box-card,
.item-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 14px;
}

.progress {
  height: 10px;
  border-radius: 999px;
}

.mobile-list {
  display: grid;
  gap: 12px;
}

.item-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.qty-controls {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 6px;
  align-items: center;
}

.qty-pill {
  min-width: 48px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-weight: 850;
  background: #f8fafc;
}

.empty-state {
  display: grid;
  place-items: center;
  text-align: center;
  min-height: 55vh;
  padding: 24px;
}

.empty-state h1 {
  font-weight: 850;
}

.scanner-modal {
  position: fixed;
  inset: 0;
  z-index: 1080;
  background: rgba(8,13,23,.92);
  padding: 12px;
}

.scanner-panel {
  max-width: 720px;
  margin: 0 auto;
  color: #fff;
}

.scanner-topbar {
  min-height: 62px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.scanner-reader {
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  min-height: 320px;
}

.scanner-help {
  color: rgba(255,255,255,.78);
  margin-top: 12px;
}

.autocomplete-wrap {
  position: relative;
}

.autocomplete-menu {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 30px rgba(16,24,40,.14);
  max-height: 240px;
  overflow: auto;
}

.autocomplete-item {
  padding: 10px 12px;
  border-bottom: 1px solid #eef2f7;
  cursor: pointer;
}

.autocomplete-item:hover {
  background: #f1f5f9;
}

.small-muted {
  color: var(--muted);
  font-size: .86rem;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 850;
}

@media (max-width: 760px) {
  .app-main {
    padding: 12px;
  }

  .page-title {
    display: grid;
  }

  .toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .toolbar > * {
    width: 100%;
  }

  .desktop-table {
    display: none;
  }

  .panel {
    padding: 14px;
  }
}

@media (min-width: 761px) {
  .mobile-only-list {
    display: none;
  }
}

.photo-thumb {
  max-width: 100%;
  max-height: 220px;
  border-radius: 8px;
  border: 1px solid var(--line);
  object-fit: cover;
  display: block;
}
.photo-row { border-top: 1px solid var(--line); padding-top: 8px; }
