:root {
  --blue: #1d4ed8;
  --blue-dark: #1e40af;
  --blue-soft: #eff6ff;
  --border: #bfdbfe;
  --bg: #ffffff;
  --green: #16a34a;
  --red: #dc2626;
  --text: #0f172a;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.hidden { display: none !important; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: #ffffff;
  border-bottom: 2px solid var(--border);
  padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
}

.brand { color: var(--blue-dark); font-weight: 800; font-size: 1.15rem; }

.mini-btn {
  background: #fff; color: var(--blue); border: 2px solid var(--blue);
  border-radius: 10px; padding: 6px 14px; font-weight: 800; cursor: pointer;
}

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 18px 14px 40px;
  display: flex; flex-direction: column; gap: 14px;
}

.title {
  text-align: center; color: var(--blue-dark); font-weight: 800;
  font-size: 1.3rem; text-transform: uppercase;
}

.route-bar {
  background: var(--blue-soft); color: var(--blue-dark);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 14px; font-weight: 800; font-size: 0.9rem;
  text-align: center; text-transform: uppercase;
}

.btn {
  width: 100%; min-height: 58px; padding: 14px 16px;
  background: #ffffff; color: var(--blue);
  border: 2px solid var(--blue); border-radius: 14px;
  font-size: 1.08rem; font-weight: 800; text-transform: uppercase;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  text-align: center; line-height: 1.25;
}
.btn:active { background: var(--blue-soft); transform: scale(0.99); }
.btn-solid { background: var(--blue); color: #ffffff; }
.btn-danger { color: var(--red); border-color: var(--red); }
.btn-green { background: var(--green); color: #ffffff; border-color: var(--green); }

.card {
  background: #ffffff; border: 2px solid var(--border); border-radius: 16px;
  padding: 16px; display: flex; flex-direction: column; gap: 12px;
}

.field-label {
  font-size: 0.9rem; font-weight: 800; color: var(--blue-dark); text-transform: uppercase;
}

.input, select {
  width: 100%; padding: 13px 14px; font-size: 1.05rem; font-weight: 700;
  border: 2px solid var(--blue); border-radius: 12px; background: #fff; color: var(--text);
}

.photo-box {
  width: 100%; aspect-ratio: 1 / 1; max-height: 340px;
  background: #f1f5f9; border: 2px solid var(--border); border-radius: 14px;
  display: flex; align-items: center; justify-content: center; overflow: hidden; cursor: pointer;
}
.photo-box img { width: 100%; height: 100%; object-fit: contain; }

.mini-item {
  display: flex; gap: 12px; align-items: center;
  border: 2px solid var(--border); border-radius: 14px; padding: 10px; background: #fff;
}
.mini-item img {
  width: 68px; height: 68px; object-fit: contain;
  background: #f1f5f9; border-radius: 10px; flex-shrink: 0;
}
.mini-info { flex: 1; font-size: 0.92rem; font-weight: 700; display: flex; flex-direction: column; gap: 4px; }

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

.cat-row { display: flex; gap: 8px; align-items: stretch; }
.cat-row .btn { flex: 1; }
.icon-btn {
  width: 54px; min-height: 58px; border-radius: 14px; background: #fff;
  border: 2px solid var(--blue); color: var(--blue); font-size: 1.15rem; font-weight: 800; cursor: pointer;
}
.icon-btn.del { border-color: var(--red); color: var(--red); }

.table-wrap { width: 100%; overflow-x: auto; border: 2px solid var(--border); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: left; font-weight: 600; }
th { background: var(--blue-soft); color: var(--blue-dark); font-weight: 800; text-transform: uppercase; }

.err-text { color: var(--red); font-weight: 800; text-align: center; text-transform: uppercase; }
.ok-text { color: var(--green); font-weight: 800; text-align: center; text-transform: uppercase; }

.modal {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.6);
  display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 999;
}
.modal-box {
  background: #fff; border: 2px solid var(--blue); border-radius: 16px;
  padding: 20px 16px; max-width: 440px; width: 100%; max-height: 88vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px; text-align: center; font-weight: 700;
}
.modal-actions { display: flex; flex-direction: column; gap: 10px; }
