* { box-sizing: border-box; }

:root {
  --bg: #0f0f10;
  --card: #18181b;
  --muted-card: #222226;
  --border: #2f2f35;
  --text: #f5f5f5;
  --muted: #a1a1aa;
  --input: #27272a;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px;
}

.login-card {
  max-width: 420px;
  margin: 8vh auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 22px;
}

.logo {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: #f5f5f5;
  color: #111;
  display: grid;
  place-items: center;
  font-weight: 800;
}

h1, h2, p { margin: 0; }
.brand h1 { font-size: 22px; }
.brand p, .hint, #recipe-count, .category { color: var(--muted); }

label {
  display: block;
  margin: 12px 0 6px;
  color: #d4d4d8;
  font-size: 14px;
}

input, select, button {
  width: 100%;
  border: 0;
  border-radius: 13px;
  padding: 12px 14px;
  font-size: 15px;
}

input, select {
  background: var(--input);
  color: #fff;
  outline: 1px solid #3f3f46;
}

button {
  margin-top: 14px;
  background: #fff;
  color: #111;
  font-weight: 700;
  cursor: pointer;
}

button.secondary {
  background: var(--input);
  color: #fff;
  outline: 1px solid #3f3f46;
}

.hint {
  margin-top: 14px;
  line-height: 1.4;
  font-size: 13px;
}

.app { display: block; }

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

.topbar h1 { font-size: 28px; }
.topbar button { width: auto; min-width: 150px; margin: 0; }

.toolbar {
  display: grid;
  grid-template-columns: 1fr 180px 140px 90px 150px;
  gap: 8px;
  margin-bottom: 14px;
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(15,15,16,.96);
  padding: 8px 0;
  backdrop-filter: blur(8px);
}

.toolbar button { margin: 0; }

.status {
  color: #fbbf24;
  margin: 10px 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  page-break-inside: avoid;
}

.card-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  width: auto;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.select-wrap input {
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  outline: none;
  accent-color: #fff;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.card h2 {
  font-size: 20px;
  line-height: 1.15;
  margin-top: 2px;
}

.category {
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 11px;
}

.print-one {
  width: auto;
  margin: 0;
  padding: 7px 10px;
  font-size: 12px;
  border-radius: 10px;
}

.photo-wrap img {
  width: 100%;
  max-height: 170px;
  object-fit: cover;
  border-radius: 12px;
  margin-top: 10px;
}

.details {
  margin-top: 8px;
}

.row {
  margin-top: 8px;
  line-height: 1.32;
  font-size: 14px;
}

.row strong {
  display: inline;
  color: #d4d4d8;
  margin-right: 4px;
}

.multiline {
  white-space: pre-line;
}

@media (max-width: 760px) {
  .shell { padding: 10px; }
  .login-card { margin: 5vh auto; padding: 18px; border-radius: 18px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar h1 { font-size: 24px; }
  .topbar button { width: 100%; }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .toolbar input { grid-column: 1 / -1; }
  .toolbar select { grid-column: 1 / -1; }
  .grid { grid-template-columns: 1fr; gap: 8px; }
  .card { padding: 10px; border-radius: 14px; }
  .card h2 { font-size: 19px; }
  .row { font-size: 13.5px; margin-top: 7px; }
}

@media (max-width: 390px) {
  .toolbar { grid-template-columns: 1fr; }
}

@media print {
  @page { margin: 10mm; }

  body {
    background: #fff;
    color: #000;
  }

  .shell { max-width: none; padding: 0; }
  .topbar, .toolbar, .status, .print-one, .select-wrap, #login-screen { display: none !important; }
  .grid { display: block; }

  .card {
    display: block;
    border: 1px solid #000;
    color: #000;
    background: #fff;
    margin: 0 0 8mm;
    border-radius: 0;
    box-shadow: none;
    padding: 5mm;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  body.print-selected .card:not(.selected-for-print) {
    display: none !important;
  }

  .card h2 { font-size: 18pt; }
  .row { font-size: 11pt; margin-top: 5px; }
  .category, .brand p, #recipe-count { color: #333; }
  .photo-wrap img { max-height: 60mm; }
}
