:root {
  --paper: #fffdf7;
  --paper-soft: #f8f3e9;
  --paper-line: #ded5c6;
  --paper-line-strong: #c9bda8;
  --ink: #171717;
  --muted: #80776c;
  --brown: #8f6549;
  --tab-paper: #fffaf0;
  --tab-edge: #d8ccb9;
  --green: #dcebdd;
  --yellow: #f7ebbf;
  --danger: #8f3328;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 18% 12%, rgba(111, 78, 50, 0.035), transparent 34%),
    radial-gradient(circle at 85% 4%, rgba(55, 43, 31, 0.025), transparent 28%),
    linear-gradient(rgba(118, 95, 68, 0.028) 1px, transparent 1px),
    var(--paper-soft);
  background-size: auto, auto, 100% 30px, auto;
  color: var(--ink);
  font-family: "Akkurat Pro", "Akkurat", Arial, sans-serif;
}

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

.staff-shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.staff-topbar,
.staff-card,
.staff-modal {
  border: 1px solid var(--paper-line);
  border-radius: 5px;
  background:
    radial-gradient(circle at 12% 10%, rgba(143, 101, 73, 0.026), transparent 35%),
    linear-gradient(rgba(118, 95, 68, 0.025) 1px, transparent 1px),
    rgba(255, 253, 247, 0.94);
  background-size: auto, 100% 30px, auto;
  box-shadow: 0 10px 24px rgba(35, 28, 22, 0.065);
}

.staff-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 18px 22px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-lockup img {
  display: block;
  mix-blend-mode: multiply;
}

.brand-lockup .mark {
  width: 28px;
  height: 28px;
  object-fit: contain;
  background: transparent;
}

.brand-lockup .wordmark {
  width: 210px;
  height: auto;
  background: transparent;
}

.staff-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 800;
}

.nav-admin {
  position: relative;
}

.notify-dot,
.inline-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-left: 7px;
  border-radius: 999px;
  background: #b22920;
  box-shadow: 0 0 0 3px rgba(178, 41, 32, 0.12);
}

.inline-dot {
  vertical-align: middle;
}

.staff-card {
  overflow: hidden;
  margin-bottom: 18px;
}

.staff-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--paper-line);
}

.staff-card-header h1,
.staff-card-header h2,
.staff-card h1 {
  margin: 4px 0 0;
}

.kicker,
label span,
th,
.meta-label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.subtle {
  color: var(--muted);
  font-weight: 700;
}

.login-card {
  width: min(520px, calc(100vw - 32px));
  margin: 12vh auto 0;
  padding: 28px;
}

.login-card form,
.admin-form,
.filters {
  display: grid;
  gap: 12px;
}

.login-card input,
.admin-form input,
.admin-form select,
.filters input,
.filters select {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--paper-line);
  border-radius: 3px;
  background:
    linear-gradient(rgba(118, 95, 68, 0.025) 1px, transparent 1px),
    #fffefa;
  background-size: 100% 13px, auto;
}

.filters {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 18px 22px;
  border-bottom: 1px solid var(--paper-line);
}

.button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 9px 14px;
  border: 1px solid #151515;
  border-radius: 3px;
  background: #111;
  color: #fff;
  font-weight: 900;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
}

.ghost-button {
  border-color: var(--tab-edge);
  background:
    linear-gradient(rgba(118, 95, 68, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(231, 221, 204, 0.18)),
    var(--tab-paper);
  background-size: 100% 13px, auto, auto;
  color: var(--brown);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.62),
    0 1px 0 rgba(55, 43, 31, 0.08);
  text-transform: none;
}

.ghost-button:hover {
  border-color: #bda990;
  background-color: #fff7e6;
  color: #6f4b32;
}

.staff-table .ghost-button {
  min-height: 34px;
  min-width: 88px;
  padding: 7px 12px;
  border-radius: 2px;
  font-size: 0.78rem;
  line-height: 1.05;
  text-transform: uppercase;
  letter-spacing: 0.055em;
}

.staff-table .table-action {
  min-height: 32px;
  min-width: 108px;
  border-color: #cdbfa8;
  background:
    linear-gradient(rgba(132, 105, 76, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.54), rgba(230, 220, 200, 0.18)),
    #fffaf0;
  background-size: 100% 10px, auto, auto;
  color: #7d563b;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.48);
}

.staff-table .text-action-cell {
  display: grid;
  gap: 7px;
  align-content: start;
  min-width: 138px;
}

.staff-table .text-main-button {
  width: 100%;
}

.text-status-stack {
  display: grid;
  gap: 2px;
  border: 1px solid rgba(205, 191, 168, 0.74);
  background:
    linear-gradient(rgba(118, 95, 68, 0.025) 1px, transparent 1px),
    rgba(255, 250, 240, 0.68);
  background-size: 100% 10px, auto;
  padding: 3px;
}

.text-status-stack .pill {
  width: 100%;
  justify-content: space-between;
  border-radius: 0;
  padding: 3px 6px;
  background: transparent;
  color: #8a6228;
}

.text-status-stack .pill.ready {
  background: transparent;
  color: #2f7446;
}

.small-button {
  min-height: 30px;
  min-width: 76px;
  padding: 6px 10px;
  font-size: 0.74rem;
}

.button[disabled],
.ghost-button[disabled] {
  cursor: not-allowed;
  opacity: 0.5;
}

.message {
  margin-top: 12px;
  color: var(--danger);
  font-weight: 800;
}

.table-wrap {
  overflow: auto;
}

.staff-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
}

.staff-table th,
.staff-table td {
  padding: 15px 16px;
  border-bottom: 1px solid var(--paper-line);
  text-align: left;
  vertical-align: top;
}

.staff-table td:nth-last-child(-n + 3) {
  white-space: nowrap;
}

.staff-table thead th {
  background: #ebe6dc;
}

.staff-table tbody tr:nth-child(even) {
  background: rgba(249, 245, 236, 0.66);
}

.staff-table strong,
.coffee-title {
  display: block;
  font-weight: 900;
}

.staff-table small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 700;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 3px 8px;
  border-radius: 2px;
  background: var(--yellow);
  color: #805c22;
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.pill.ready {
  background: var(--green);
  color: #2f7446;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 18, 16, 0.36);
}

.staff-modal {
  width: min(980px, calc(100vw - 48px));
  max-height: min(88vh, 920px);
  overflow: auto;
}

.sheet-preview-modal {
  position: relative;
  width: min(1500px, calc(100vw - 32px));
  height: min(88vh, 920px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sheet-preview-modal::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 56px;
  border-top: 1px solid #d9d5cc;
  background:
    linear-gradient(180deg, rgba(247, 244, 237, 0.97), rgba(239, 235, 226, 0.99)),
    var(--paper);
  pointer-events: auto;
  z-index: 20;
}

.modal-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--paper-line);
  background: var(--paper);
}

.modal-body {
  padding: 18px 20px 22px;
}

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

.sheet-preview-body {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: #fff;
}

.sheet-preview-frame {
  display: block;
  width: 1600px;
  min-width: 100%;
  height: 100%;
  min-height: 720px;
  border: 0;
  background: #fff;
}

.sheet-tab-guard {
  display: none;
}

.price-grid,
.details-grid,
.members-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.ledger-price-wrap {
  border: 1px solid rgba(43, 38, 31, 0.74);
  background:
    linear-gradient(90deg, transparent 0 18%, rgba(151, 64, 55, 0.16) 18% calc(18% + 1px), transparent calc(18% + 1px) 51%, rgba(72, 127, 150, 0.15) 51% calc(51% + 1px), transparent calc(51% + 1px) 100%),
    linear-gradient(rgba(104, 139, 153, 0.10) 1px, transparent 1px),
    radial-gradient(circle at 15% 0%, rgba(143, 101, 73, 0.05), transparent 28%),
    #fffaf0;
  background-size: auto, 100% 25px, auto, auto;
  padding: 18px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.54);
}

.ledger-price-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.ledger-price-table th,
.ledger-price-table td {
  border: 1px solid rgba(43, 38, 31, 0.68);
  padding: 10px 12px;
  text-align: right;
  background: rgba(255, 253, 247, 0.44);
}

.ledger-price-table thead th {
  background: rgba(247, 237, 201, 0.86);
  color: #171717;
  font-size: 0.78rem;
}

.ledger-price-table th:first-child,
.ledger-price-table td:first-child {
  text-align: left;
}

.ledger-price-table tbody th {
  color: #171717;
  letter-spacing: 0.07em;
}

.ledger-price-table .ledger-accent-row th,
.ledger-price-table .ledger-accent-row td {
  background: #dfead9;
}

.ledger-price-table .ledger-b2b-row th,
.ledger-price-table .ledger-b2b-row td {
  background: #fbf7ea;
}

.ledger-price-table th small {
  display: inline-block;
  margin-left: 6px;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ledger-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.price-row,
.detail-row {
  padding: 12px;
  border: 1px solid var(--paper-line);
  border-radius: 6px;
  background: rgba(255, 253, 248, 0.72);
}

.text-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.text-output {
  min-height: 240px;
  padding: 16px;
  border: 1px solid var(--paper-line);
  border-radius: 6px;
  background: #fffefa;
  white-space: pre-wrap;
  line-height: 1.5;
}

.text-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.feedback-modal {
  width: min(760px, calc(100vw - 48px));
}

.feedback-form {
  display: grid;
  gap: 14px;
}

.feedback-form textarea,
.feedback-form input[type="url"],
.feedback-form input[type="file"] {
  width: 100%;
  padding: 13px;
  border: 1px solid var(--paper-line);
  border-radius: 7px;
  background: #fffefa;
}

.feedback-form textarea {
  resize: vertical;
}

.feedback-upload {
  display: grid;
  gap: 6px;
}

.feedback-upload small {
  color: var(--muted);
  font-weight: 700;
}

.request-context {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.request-context > div {
  padding: 12px;
  border: 1px solid var(--paper-line);
  border-radius: 6px;
  background: rgba(255, 253, 248, 0.72);
}

.request-context .meta-label {
  display: block;
  margin-bottom: 7px;
}

.admin-feedback-card {
  margin-bottom: 18px;
}

.feedback-message-cell {
  max-width: 560px;
  min-width: 280px;
}

.feedback-details summary {
  cursor: pointer;
  color: var(--brown);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.feedback-details p {
  margin: 8px 0 0;
  white-space: pre-wrap;
  line-height: 1.45;
}

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

.modal-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pdf-preview-modal {
  width: min(1120px, calc(100vw - 48px));
}

.pdf-preview-body {
  display: grid;
  gap: 10px;
  padding: 16px 20px 20px;
}

.pdf-preview-body small {
  color: var(--muted);
  font-weight: 800;
}

.pdf-preview-frame {
  width: 100%;
  height: min(74vh, 820px);
  border: 1px solid var(--paper-line);
  border-radius: 4px;
  background: #fff;
}

.small-button {
  min-height: 32px;
  padding: 7px 10px;
  font-size: 0.72rem;
}

.coffee-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.row-feedback-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 28px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(150, 42, 34, 0.42);
  border-radius: 999px;
  background: #fff8f3;
  color: #8c3028;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 900;
  cursor: pointer;
}

.row-feedback-dot span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #b83c32;
  box-shadow: 0 0 0 3px rgba(184, 60, 50, 0.13);
}

.feedback-thread-list {
  display: grid;
  gap: 12px;
}

.feedback-thread-list article {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--paper-line);
  border-radius: 6px;
  background: #fffefa;
}

.feedback-thread-list article.open {
  border-color: rgba(184, 60, 50, 0.32);
  background: #fff8f3;
}

.feedback-thread-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.feedback-thread-list p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.45;
}

.admin-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 18px;
}

.admin-form {
  padding: 20px 22px;
}

.admin-table {
  min-width: 980px;
}

@media (max-width: 860px) {
  .staff-topbar,
  .staff-card-header {
    display: grid;
  }

  .filters,
  .admin-layout,
  .price-grid,
  .details-grid,
  .request-context {
    grid-template-columns: 1fr;
  }
}
