:root {
  --bg-top: #f0f4f8;
  --bg-bottom: #f8fafc;
  --surface: #ffffff;
  --surface-soft: #f7fafc;
  --border: #d5dee8;
  --border-strong: #bccad8;
  --text: #16212f;
  --text-muted: #5d6b7a;
  --brand: #0f766e;
  --brand-strong: #0b5b55;
  --brand-soft: #e3f3f1;
  --danger: #b4233a;
  --danger-soft: #fce9ec;
  --ok: #1f7a45;
  --ok-soft: #eaf7ef;
  --shadow: 0 10px 26px rgba(18, 35, 55, 0.08);
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Avenir Next", "Segoe UI", "Trebuchet MS", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 8% -10%, #d9eef2 0%, transparent 55%),
    radial-gradient(1200px 500px at 100% -15%, #f0e9de 0%, transparent 50%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

.page {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(188, 202, 216, 0.55);
}

.brand {
  font-family: "Palatino Linotype", "Book Antiqua", serif;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--brand-strong);
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 600;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: all 0.16s ease;
}

.nav-links a:hover {
  color: var(--brand-strong);
  border-color: #c9e5e2;
  background: #edf9f7;
}

.user-box {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.93rem;
  color: var(--text-muted);
}

.container {
  max-width: 1220px;
  margin: 18px auto;
  padding: 0 14px 26px;
}

h1 {
  margin: 8px 0 14px;
  font-size: 1.7rem;
  letter-spacing: 0.1px;
}

h2 {
  margin: 0 0 10px;
  font-size: 1.08rem;
}

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

.collapsed {
  display: none;
}

label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.92rem;
}

input,
select,
button,
.btn {
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  padding: 9px 10px;
  outline: none;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

input:focus,
select:focus {
  border-color: #75b8b2;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

button,
.btn {
  border: 1px solid #9ed7d2;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-weight: 700;
  border-radius: 9px;
  padding: 8px 12px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.16s ease;
}

button:hover,
.btn:hover {
  background: #d5efec;
  border-color: #83c8c2;
}

.danger {
  background: var(--danger-soft);
  border-color: #efb3be;
  color: var(--danger);
}

.danger:hover {
  background: #f8d9df;
}

.alert {
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  border: 1px solid;
  font-weight: 600;
}

.alert-success {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: #bfe6cb;
}

.alert-error {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: #efc2ca;
}

.grid-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  align-items: end;
}

.grid-inline-six {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr auto;
  gap: 8px;
}

.inline-form {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 6px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) 120px auto;
  gap: 8px;
  margin-bottom: 11px;
}

.table-wrap {
  overflow-x: auto;
  margin-bottom: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 14px rgba(25, 41, 58, 0.05);
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid #e4ebf2;
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f5f9fc;
  color: #425265;
  font-weight: 700;
  font-size: 0.92rem;
}

tbody tr:nth-child(even) {
  background: #fbfdff;
}

tbody tr:hover {
  background: #f3f9fb;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 8px 0 12px;
}

.pager .active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.auth-wrap {
  max-width: 460px;
  margin: 56px auto;
}

.recipe-items {
  min-width: 250px;
}

.recipe-item-row {
  display: grid;
  grid-template-columns: 1fr 120px auto;
  gap: 7px;
  align-items: center;
  margin-bottom: 7px;
}

.hint {
  min-height: 24px;
  font-size: 0.93rem;
  color: var(--text-muted);
}

.barcode-page img {
  width: min(560px, 100%);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}

@media (max-width: 980px) {
  .topbar {
    position: static;
    grid-template-columns: 1fr;
  }

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

  .user-box {
    justify-content: space-between;
  }

  th,
  td {
    white-space: nowrap;
  }

  .recipe-item-row {
    grid-template-columns: 1fr;
  }
}
