:root {
  --ink: #211912;
  --muted: #71675d;
  --paper: #fffaf2;
  --surface: #ffffff;
  --line: #eadfce;
  --espresso: #3a2417;
  --roast: #8f3f24;
  --gold: #d89535;
  --blue: #254b59;
  --shadow: 0 18px 48px rgba(33, 25, 18, 0.1);
}

* {
  box-sizing: border-box;
}

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

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  touch-action: manipulation;
}

a {
  color: inherit;
  text-decoration: none;
}

.admin-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px clamp(18px, 4vw, 42px);
  background: rgba(255, 250, 242, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.admin-header p,
.editor-panel p {
  margin: 0;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-header h1 {
  margin: 2px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1;
}

.admin-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-header a,
.toolbar button,
.editor-actions button {
  min-height: 42px;
  padding: 10px 14px;
  border: 0;
  border-radius: 6px;
  background: var(--ink);
  color: white;
  font-weight: 900;
  cursor: pointer;
}

main {
  display: grid;
  gap: 22px;
  padding: 24px clamp(18px, 4vw, 42px) 42px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.stats-grid article,
.sync-panel,
.toolbar,
.table-shell,
.editor-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.stats-grid article {
  padding: 18px;
}

.stats-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.stats-grid strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr 190px auto auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
}

.sync-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
}

.sync-panel p {
  margin: 0;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sync-panel h2 {
  margin: 4px 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.7rem, 3vw, 2.6rem);
  line-height: 1;
}

.sync-panel span {
  color: var(--muted);
  font-size: 0.9rem;
}

.toast-settings {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1fr);
  gap: 18px;
  align-items: start;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.toast-settings form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}

.toast-settings button,
.sync-panel button {
  min-height: 48px;
  flex: 0 0 auto;
  padding: 12px 18px;
  border: 0;
  border-radius: 6px;
  background: var(--roast);
  color: white;
  font-weight: 900;
  cursor: pointer;
}

.sync-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.sync-actions button:first-child,
.toast-settings button {
  background: var(--ink);
}

.restaurant-results {
  display: grid;
  gap: 10px;
}

.restaurant-results p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.restaurant-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.restaurant-card strong,
.restaurant-card small {
  display: block;
}

.restaurant-card small {
  margin-top: 3px;
  color: var(--muted);
  word-break: break-word;
}

.restaurant-card button {
  min-height: 38px;
  align-self: center;
  padding: 8px 12px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 900;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdf8;
  color: var(--ink);
}

textarea {
  min-height: 96px;
  resize: vertical;
}

.product-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 430px);
  gap: 18px;
  align-items: start;
}

.table-shell {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.selected {
  background: #fff4e2;
}

.product-name {
  display: grid;
  gap: 3px;
}

.product-name strong {
  font-size: 0.98rem;
}

.product-name small,
.pill {
  color: var(--muted);
  font-size: 0.78rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: #f4eadb;
  font-weight: 900;
}

.pill.off {
  background: #eee;
  color: #777;
}

.edit-button {
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  font-weight: 900;
  cursor: pointer;
}

.editor-panel {
  position: sticky;
  top: 110px;
  display: grid;
  gap: 13px;
  padding: 18px;
}

.editor-panel h2 {
  margin: 2px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.1rem;
  line-height: 1;
}

.form-grid,
.switch-row,
.editor-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.switch-row label {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdf8;
  color: var(--ink);
}

.switch-row input {
  width: auto;
  min-height: auto;
}

.editor-actions button:first-child {
  background: var(--roast);
}

.editor-actions button:last-child {
  background: #eee;
  color: var(--ink);
}

.status {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

@media (max-width: 980px) {
  .stats-grid,
  .toolbar,
  .sync-panel,
  .toast-settings,
  .product-editor {
    grid-template-columns: 1fr;
  }

  .sync-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .toast-settings form {
    grid-template-columns: 1fr;
  }

  .editor-panel {
    position: static;
  }
}

@media (max-width: 620px) {
  .admin-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid,
  .switch-row,
  .editor-actions {
    grid-template-columns: 1fr;
  }
}
