:root {
  color-scheme: light;
  --bg: #fffdf6;
  --surface: #fffaf1;
  --surface-2: #f7edde;
  --surface-3: #fdf5e9;
  --text: #1f2021;
  --muted: #726d65;
  --line: #e5d7c7;
  --accent: #c1762e;
  --accent-2: #1f2021;
  --accent-soft: rgba(193, 118, 46, 0.14);
  --danger: #a33a25;
  --shadow: 0 14px 34px rgba(31, 32, 33, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    "Avenir Next", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

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

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0 48px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-family: "Cormorant Garamond", Didot, "Bodoni 72", "Times New Roman", serif;
  font-size: clamp(34px, 5vw, 58px);
  font-weight: 400;
  line-height: 0.96;
  letter-spacing: 0;
  text-transform: uppercase;
}

h2 {
  font-size: 20px;
  line-height: 1.2;
}

.sync-state {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.86);
  padding: 8px 12px;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.user-state {
  background: #ffffff;
  color: var(--text);
  font-weight: 700;
}

.logout-button {
  min-height: 38px;
}

.text-link {
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
}

.controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) minmax(240px, 1.2fr);
  gap: 14px;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.92);
  box-shadow: var(--shadow);
}

.admin-shell {
  max-width: 860px;
}

.admin-controls {
  grid-template-columns: minmax(240px, 1fr) 220px;
  align-items: end;
}

.connect-controls {
  grid-template-columns: 240px minmax(260px, 1fr) 160px 190px;
  align-items: end;
}

.button-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  padding: 0 14px;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.button-link:hover {
  background: #9f5f24;
}

.secondary-link {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
}

.secondary-link:hover {
  background: #eef3ef;
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

select,
input,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

select:focus,
input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(193, 118, 46, 0.16);
}

select:disabled,
input:disabled,
textarea:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

textarea {
  padding-top: 10px;
  padding-bottom: 10px;
  line-height: 1.45;
}

.results {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  border-top: 4px solid var(--accent);
}

.order-panel {
  overflow: hidden;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  border-top: 4px solid var(--accent);
}

.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

#resultMeta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  padding: 0 16px;
  font-weight: 700;
  cursor: pointer;
}

button:hover:not(:disabled) {
  background: #9f5f24;
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

.secondary-button:hover:not(:disabled) {
  background: var(--surface-2);
}

.order-actions {
  display: flex;
  gap: 10px;
}

.order-comment {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.request-controls {
  grid-template-columns: minmax(220px, 320px) 150px;
  align-items: end;
}

.request-list {
  display: grid;
  gap: 14px;
}

.request-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  border-top: 4px solid var(--accent);
}

.request-card-head,
.request-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
}

.request-card-head {
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.request-card-foot {
  border-top: 1px solid var(--line);
}

.request-comment {
  padding: 0 16px 16px;
  color: var(--muted);
}

.request-comment-editor {
  padding: 14px 16px 0;
}

.request-comment-editor textarea {
  min-height: 70px;
  resize: vertical;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 10px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.status-new {
  background: var(--accent-soft);
  color: #8a4f1b;
}

.status-confirmed {
  background: rgba(31, 32, 33, 0.1);
  color: var(--text);
}

.status-cancelled {
  background: rgba(180, 35, 24, 0.12);
  color: var(--danger);
}

.request-items-table {
  min-width: 560px;
}

.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-panel {
  width: min(520px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  border-top: 4px solid var(--accent);
}

.login-panel-head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.login-panel-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.project-login-link {
  display: inline-flex;
  margin-bottom: 22px;
}

.login-form {
  display: grid;
  gap: 14px;
  padding: 20px 20px 0;
}

.login-help-link {
  display: inline-flex;
  margin-top: 16px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.login-help-link:hover {
  text-decoration: underline;
}

.login-message {
  min-height: 20px;
  color: var(--muted);
  font-size: 14px;
}

.login-note {
  margin-top: 0;
  padding: 4px 20px 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

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

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

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
  background: var(--surface-3);
}

td {
  font-size: 15px;
}

tbody tr:hover {
  background: rgba(193, 118, 46, 0.06);
}

tbody tr.selected {
  background: rgba(193, 118, 46, 0.11);
}

.dish-name {
  font-weight: 700;
}

.quantity-input {
  width: 92px;
  min-height: 38px;
  padding: 0 10px;
  text-align: center;
}

.add-button {
  min-width: 108px;
}

.order-table {
  min-width: 520px;
}

.order-table th:nth-child(2),
.order-table td:nth-child(2) {
  width: 130px;
}

.order-table th:nth-child(3),
.order-table td:nth-child(3) {
  width: 120px;
}

.muted {
  color: var(--muted);
}

.empty {
  display: none;
  padding: 34px 16px;
  color: var(--muted);
  text-align: center;
}

.empty.visible {
  display: block;
}

.status-box {
  min-height: 280px;
  margin: 0;
  overflow: auto;
  padding: 16px;
  background: #1f2021;
  color: #fffdf6;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
}

.error {
  color: var(--danger);
}

.project-shell {
  max-width: 1120px;
}

.project-hero {
  align-items: center;
  margin-bottom: 24px;
}

.hero-note {
  max-width: 620px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.project-card {
  min-height: 178px;
  display: grid;
  align-content: start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  padding: 18px;
  text-decoration: none;
}

.project-card:hover {
  border-color: rgba(193, 118, 46, 0.54);
  transform: translateY(-1px);
}

.project-card span:first-child {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.project-card h2 {
  font-size: 20px;
}

.project-card p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.project-card-primary {
  background: var(--text);
  color: #ffffff;
}

.project-card strong {
  font-size: 20px;
  line-height: 1.15;
}

.project-card span:last-child {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.project-card-primary span:last-child {
  color: rgba(255, 255, 255, 0.78);
}

.card-kicker {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.project-card-primary .card-kicker {
  color: #f3c08e;
}

.project-section {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  border-top: 4px solid var(--accent);
}

.section-title {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

.status-tile {
  min-height: 112px;
  display: grid;
  align-content: start;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-3);
  padding: 14px;
}

.status-tile-wide {
  grid-column: 1 / -1;
  min-height: 86px;
}

.status-tile span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.status-tile strong {
  font-size: 16px;
  line-height: 1.35;
}

.status-tile a {
  color: var(--accent);
}

.instruction-card {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.steps-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 22px;
}

.steps-list li {
  line-height: 1.5;
}

.note-box {
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  padding: 12px 14px;
  color: var(--text);
  line-height: 1.5;
}

code {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-3);
  padding: 1px 5px;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.92em;
}

.access-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

.access-column,
.folder-list > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-3);
  padding: 14px;
}

.access-column {
  display: grid;
  gap: 8px;
}

.access-column p,
.folder-list p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.folder-list {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.project-two-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.project-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  border-top: 4px solid var(--accent);
}

.project-steps,
.project-checklist {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 18px 18px 18px 38px;
}

.project-steps li,
.project-checklist li {
  line-height: 1.5;
}

.status-box.compact {
  min-height: auto;
  margin: 0 18px 18px;
  border-radius: 8px;
}

.project-status-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 18px;
}

.project-status-list div {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-3);
  padding: 14px;
}

.project-status-list dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.project-status-list dd {
  margin: 0;
  line-height: 1.45;
}

.folder-list > div {
  display: grid;
  gap: 6px;
}

.folder-list span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

@media (max-width: 820px) {
  .shell {
    width: min(100% - 20px, 680px);
    padding-top: 18px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .sync-state {
    white-space: normal;
  }

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

  .admin-controls {
    grid-template-columns: 1fr;
  }

  .connect-controls {
    grid-template-columns: 1fr;
  }

  .request-controls {
    grid-template-columns: 1fr;
  }

  .project-grid,
  .status-grid,
  .access-grid,
  .project-two-columns {
    grid-template-columns: 1fr;
  }

  .status-tile-wide {
    grid-column: auto;
  }

  .results-head {
    align-items: stretch;
    flex-direction: column;
  }

  .request-card-head,
  .request-card-foot {
    align-items: stretch;
    flex-direction: column;
  }

  .order-actions {
    flex-direction: column;
  }

  button {
    width: 100%;
  }

  .quantity-input {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .shell {
    width: calc(100% - 14px);
    padding: 12px 0 30px;
  }

  .topbar {
    gap: 14px;
    margin-bottom: 14px;
  }

  .top-actions {
    gap: 8px;
  }

  .eyebrow {
    font-size: 12px;
  }

  h1 {
    font-size: clamp(36px, 13vw, 52px);
  }

  h2 {
    font-size: 18px;
  }

  .controls,
  .order-comment,
  .login-form,
  .status-grid,
  .access-grid,
  .folder-list,
  .instruction-card {
    padding: 12px;
  }

  .controls {
    gap: 10px;
    margin-bottom: 12px;
  }

  .results-head,
  .request-card-head,
  .request-card-foot,
  .login-panel-head,
  .section-title {
    padding: 13px;
  }

  .sync-state,
  .button-link,
  button,
  input,
  select,
  textarea {
    min-height: 46px;
  }

  .table-wrap {
    overflow: visible;
    padding: 10px;
  }

  table,
  .order-table,
  .request-items-table {
    min-width: 0;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
    width: 100%;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 10px;
  }

  tr {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
  }

  tbody tr:hover,
  tbody tr.selected {
    background: var(--surface);
  }

  tbody tr.selected {
    border-color: rgba(193, 118, 46, 0.62);
    box-shadow: inset 4px 0 0 var(--accent);
  }

  td {
    display: grid;
    grid-template-columns: minmax(92px, 36%) minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
  }

  td:last-child {
    border-bottom: 0;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
  }

  td[data-label=""] {
    display: block;
  }

  td[data-label=""]::before {
    content: none;
  }

  .dish-name {
    display: block;
    font-size: 16px;
    line-height: 1.25;
  }

  .quantity-input {
    min-height: 48px;
    font-size: 18px;
  }

  .add-button,
  .order-actions button,
  td[data-label=""] button {
    width: 100%;
  }

  .order-table th:nth-child(2),
  .order-table td:nth-child(2),
  .order-table th:nth-child(3),
  .order-table td:nth-child(3) {
    width: auto;
  }

  .request-card,
  .order-panel,
  .results,
  .login-panel,
  .project-panel,
  .project-section {
    box-shadow: 0 10px 26px rgba(31, 32, 33, 0.06);
  }

  .request-comment-editor {
    padding: 12px 13px 0;
  }

  .login-note {
    padding: 4px 13px 16px;
  }
}
