.admin-breadcrumb {
  margin: 0 0 12px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.admin-breadcrumb a {
  color: var(--primary);
  text-decoration: none;
}

.admin-breadcrumb a:hover {
  text-decoration: underline;
}

.admin-page .topbar {
  gap: 12px;
}

.admin-page .icon-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.admin-title {
  flex: 1;
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.admin-tab {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.admin-tab.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

.admin-db-banner {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.9rem;
  border: 1px solid var(--border);
}

.admin-db-banner.error {
  background: #fff0ee;
  color: #c0392b;
}

.recipe-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.recipe-pagination .page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.recipe-pagination .page-info,
.recipe-pagination .page-num {
  font-size: 0.88rem;
  color: var(--text-muted);
}

#recipe-name-hint.ok {
  color: #2e7d32;
}

#recipe-name-hint.warn {
  color: #c0392b;
}

.data-card-head h3 {
  word-break: break-word;
}

.admin-panel {
  display: none;
}

.admin-panel.active {
  display: block;
}

.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.action-btn.small.secondary {
  background: transparent;
  color: var(--text-secondary, #666);
  border: 1px solid var(--border-color, #ddd);
}

.action-btn.small.secondary:hover:not(:disabled) {
  background: var(--surface-muted, #f5f5f5);
  color: var(--text-primary, #222);
}

.sync-fieldset {
  border: 1px solid var(--border-color, #ddd);
  border-radius: 8px;
  padding: 10px 12px 12px;
  margin: 12px 0;
}

.sync-fieldset legend {
  padding: 0 6px;
  font-size: 0.9rem;
  color: var(--text-secondary, #666);
}

.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 14px;
  margin-top: 6px;
  font-size: 0.95rem;
}

#sync-prices-dialog .field-hint code {
  font-size: 0.85em;
}

.panel-toolbar.compact {
  margin-bottom: 10px;
}

.list-filters {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.filter-label {
  flex-shrink: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 2.5em;
}

.filter-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  opacity: 0.85;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}

.filter-chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  cursor: pointer;
  line-height: 1.2;
}

.filter-chip.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

.filter-chip.disabled,
.filter-chip:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.recipe-entry-filters {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recipe-entry-filters .filter-label {
  min-width: 2.8em;
}

.search-field {
  display: block;
}

.search-field input {
  width: 100%;
  box-sizing: border-box;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  font-size: 0.95rem;
}

.search-field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.list-summary {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.list-summary.warn {
  color: #c44;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.data-card-head h3 {
  margin: 0 0 4px;
  font-size: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.4;
  vertical-align: middle;
}

.tag.group {
  background: var(--primary-soft);
  color: var(--primary);
}

.tag.meat { background: #fff0f0; color: #b44; }
.tag.vegetable { background: #f0fff4; color: #2a7; }
.tag.soup { background: #f0f8ff; color: #38c; }
.tag.staple { background: #fff8e6; color: #a80; }
.tag.delivery { background: #f5f0ff; color: #639; }
.tag.restaurant { background: #fff5f0; color: #c60; }

.panel-toolbar h2,
.panel-toolbar h3 {
  margin: 0;
  font-size: 1rem;
}

.action-btn.small {
  width: auto;
  padding: 8px 14px;
  font-size: 0.88rem;
  margin-top: 0;
}

.data-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.data-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.data-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.data-card-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.card-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.card-actions button {
  border: none;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
}

.card-actions .danger {
  background: #fff0f0;
  color: #c44;
}

.formula-section {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.formula-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.formula-row:last-child {
  margin-bottom: 8px;
  padding-bottom: 0;
  border-bottom: none;
}

.formula-row-line1 {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.formula-row-line1 .ingredient-picker {
  flex: 1;
  min-width: 0;
}

.formula-row-line2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.formula-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.formula-field-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.formula-row .formula-unit,
.formula-row .formula-qty {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-size: 1rem;
}

.formula-row .formula-unit {
  text-align: left;
}

.formula-row .remove-row {
  flex-shrink: 0;
  width: 44px;
  min-width: 44px;
  height: 44px;
  border: none;
  background: #fff0f0;
  color: #c44;
  border-radius: 10px;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

@media (min-width: 560px) {
  .formula-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 92px minmax(108px, 140px) 44px;
    grid-template-areas: "picker unit qty remove";
    gap: 8px;
    align-items: end;
    margin-bottom: 8px;
    padding-bottom: 0;
    border-bottom: none;
  }

  .formula-row-line1,
  .formula-row-line2 {
    display: contents;
  }

  .formula-row-line1 .ingredient-picker {
    grid-area: picker;
  }

  .formula-row-line1 .remove-row {
    grid-area: remove;
    align-self: end;
  }

  .formula-field-unit {
    grid-area: unit;
  }

  .formula-field-qty {
    grid-area: qty;
  }

  .formula-field-label {
    display: none;
  }

  .formula-row .formula-unit,
  .formula-row .formula-qty {
    min-height: 40px;
    font-size: 0.9rem;
    padding: 10px;
  }
}

.ingredient-picker {
  position: relative;
}

.ingredient-search {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text);
  box-sizing: border-box;
}

.ingredient-search::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.ingredient-search:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft);
}

.ingredient-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 200px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 20;
}

.ingredient-dropdown.hidden {
  display: none;
}

.ingredient-option {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  text-align: left;
  font-size: 0.88rem;
  cursor: pointer;
  color: var(--text);
}

.ingredient-option:hover,
.ingredient-option.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.ingredient-empty {
  padding: 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

.field textarea,
.field select,
.dialog-form .field input[type="text"],
.dialog-form .field input[type="number"] {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
}

.dialog-form .field {
  margin-bottom: 16px;
}

.dialog-form .field span {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
}

.dialog-form .field-primary {
  margin-bottom: 18px;
}

.dialog-form .field-name-input {
  min-height: 52px;
  padding: 14px 16px;
  font-size: 1.12rem;
  font-weight: 500;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
}

.dialog-form #recipe-fixed-price {
  min-height: 48px;
  padding: 12px 16px;
  font-size: 1.1rem;
  font-weight: 500;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
}

.dialog-form .field-name-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 1rem;
}

.dialog-form .field-name-input:focus,
.dialog-form .field input:focus,
.dialog-form .field select:focus,
.dialog-form .field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.dialog-form .field input[type="number"] {
  min-height: 44px;
  font-size: 1rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-hint.left {
  text-align: left;
  margin: 8px 0 0;
}

.dialog {
  border: none;
  border-radius: 16px;
  padding: 0;
  width: min(480px, calc(100% - 32px));
  max-height: 90vh;
  overflow: visible;
}

.dialog.wide {
  width: min(560px, calc(100% - 24px));
}

.dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

.dialog-form {
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.dialog-header h3 {
  margin: 0;
}

.dialog-form .field,
.dialog-form .formula-section {
  padding: 0 20px;
}

.dialog-form > .field:first-of-type {
  margin-top: 16px;
}

.dialog-footer {
  display: flex;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  margin-top: 16px;
}

.dialog-footer .action-btn {
  flex: 1;
  margin-top: 0;
}

.btn-icon {
  border: none;
  background: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}

.empty-tip {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-muted);
}

@media (max-width: 559px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .dialog.wide {
    width: calc(100% - 16px);
    max-height: 95dvh;
  }

  .dialog-form .field,
  .dialog-form .formula-section {
    padding: 0 14px;
  }
}
