:root {
  --bg: #eef2ec;
  --bg-accent: radial-gradient(circle at top left, rgba(68, 114, 88, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(207, 153, 108, 0.18), transparent 24%),
    linear-gradient(180deg, #f6f8f3 0%, #edf2eb 48%, #e7ede7 100%);
  --panel: rgba(251, 252, 249, 0.9);
  --panel-strong: #ffffff;
  --line: rgba(44, 57, 47, 0.12);
  --text: #1f2a22;
  --muted: #627166;
  --brand: #336b52;
  --brand-strong: #234d3a;
  --teal: #245f61;
  --teal-soft: rgba(36, 95, 97, 0.1);
  --warning-bg: rgba(207, 153, 108, 0.12);
  --warning-line: rgba(175, 115, 68, 0.22);
  --shadow: 0 24px 60px rgba(44, 57, 47, 0.1);
  --shadow-soft: 0 10px 30px rgba(44, 57, 47, 0.06);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  background-image: var(--bg-accent);
  color: var(--text);
  font-family: "Manrope", sans-serif;
}

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

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

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

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(480px, 100%);
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 0 0 12px;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.03em;
}

.login-card__logo {
  display: block;
  width: min(260px, 70%);
  margin-bottom: 24px;
}

.login-form,
.user-form {
  display: grid;
  gap: 16px;
}

.form-error {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--warning-line);
  border-radius: var(--radius-md);
  background: var(--warning-bg);
  color: #8a3d19;
  font-weight: 700;
}

.account-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -6px 0 18px;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  background: rgba(255, 250, 243, 0.75);
}

.account-bar span {
  font-weight: 800;
  color: var(--brand-strong);
}

.user-form {
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  align-items: end;
  margin-bottom: 24px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.68);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(320px, 1fr);
  gap: 24px;
  align-items: stretch;
}

.hero__copy,
.hero__stats,
.panel {
  background: var(--panel);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: var(--shadow);
}

.hero__copy {
  padding: 34px;
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
}

.hero__copy h1,
.panel h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.03em;
}

.hero__copy h1 {
  font-size: clamp(2.4rem, 5vw, 4.25rem);
  line-height: 0.98;
  max-width: 10ch;
}

.panel__eyebrow,
.field__hint,
.form-notice,
.empty-state,
th,
td {
  color: var(--muted);
}

.eyebrow,
.panel__eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.75rem;
  font-weight: 700;
  margin: 0 0 12px;
}

.hero__stats {
  display: grid;
  gap: 14px;
  padding: 20px;
  border-radius: var(--radius-xl);
}

.hero__logo {
  width: min(420px, 48vw);
  max-width: 100%;
  height: auto;
  display: block;
}

.stat-card {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}

.stat-card__label {
  display: block;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin-bottom: 10px;
}

.stat-card__value {
  font-size: 2rem;
  font-family: "Space Grotesk", sans-serif;
}

.top-nav {
  display: inline-flex;
  gap: 10px;
  margin: 24px 0 18px;
  padding: 8px;
  background: rgba(255, 250, 243, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
}

.top-nav__link,
.service-switch__button,
.filter-chip,
.button {
  border: 0;
  border-radius: 999px;
  transition: transform 180ms ease, background-color 180ms ease, color 180ms ease,
    box-shadow 180ms ease;
}

.top-nav__link,
.service-switch__button,
.filter-chip {
  background: transparent;
  color: var(--muted);
  padding: 10px 16px;
  font-weight: 700;
}

.top-nav__link.is-active,
.service-switch__button.is-active,
.filter-chip.is-active {
  background: var(--text);
  color: #fff8ee;
  box-shadow: 0 10px 22px rgba(22, 20, 17, 0.15);
}

.screen {
  display: none;
}

.screen.is-active {
  display: block;
  animation: fadeUp 260ms ease;
}

.panel {
  padding: 28px;
  border-radius: var(--radius-xl);
}

.panel--form {
  min-height: 520px;
}

.order-form {
  display: grid;
  gap: 24px;
}

.panel__header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 26px;
}

.panel__header--queue {
  align-items: center;
}

.service-switch,
.filter-group {
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(31, 27, 23, 0.06);
}

.intro-grid,
.dynamic-fields,
.form-section__grid {
  display: grid;
  gap: 16px;
}

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

.dynamic-fields {
  gap: 18px;
}

.form-section {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(247, 250, 246, 0.92));
  box-shadow: var(--shadow-soft);
}

.form-section__eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--brand);
}

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

.form-section {
  padding: 20px;
}

.form-section__header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.form-section__count {
  flex: 0 0 auto;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(31, 42, 34, 0.06);
  font-size: 0.82rem;
  font-weight: 700;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field--full {
  grid-column: 1 / -1;
}

.field__label {
  font-weight: 700;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.field__required {
  color: var(--brand);
}

.field__input,
.field textarea,
.field select {
  width: 100%;
  min-height: 54px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: #fff;
  padding: 14px 16px;
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.field textarea {
  min-height: 118px;
  resize: vertical;
}

.field__input:focus,
.field textarea:focus,
.field select:focus {
  outline: 2px solid rgba(51, 107, 82, 0.14);
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(51, 107, 82, 0.08);
  transform: translateY(-1px);
}

.form-notice {
  padding: 14px 16px;
  border: 1px solid var(--warning-line);
  border-radius: var(--radius-md);
  background: var(--warning-bg);
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-start;
}

.button {
  min-height: 50px;
  padding: 0 22px;
  font-weight: 800;
}

.button:hover,
.top-nav__link:hover,
.service-switch__button:hover,
.filter-chip:hover {
  transform: translateY(-1px);
}

.button--primary {
  background: var(--brand);
  color: #fff7f1;
}

.button--primary:hover {
  background: var(--brand-strong);
}

.button--ghost {
  background: rgba(31, 42, 34, 0.06);
  color: var(--text);
}

.queue-wrap {
  overflow-x: auto;
}

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

.queue-row.is-expanded td {
  border-bottom-color: transparent;
}

.queue-row.is-voided {
  opacity: 0.72;
}

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

th {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

td {
  color: var(--text);
}

.queue-cell-action {
  margin-top: 10px;
}

.queue-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.type-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.type-pill {
  background: rgba(13, 97, 91, 0.1);
  color: var(--teal);
}

.status-pill[data-status="outstanding"] {
  background: rgba(180, 87, 31, 0.12);
  color: var(--brand-strong);
}

.status-pill[data-status="in_progress"] {
  background: rgba(13, 97, 91, 0.12);
  color: var(--teal);
}

.status-pill[data-status="completed"] {
  background: rgba(31, 27, 23, 0.08);
  color: var(--text);
}

.queue-select {
  width: 100%;
  min-width: 148px;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.ordered-by-button,
.details-toggle,
.queue-action-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  font-weight: 700;
}

.queue-action-button {
  min-height: 36px;
  padding: 0 12px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 0.82rem;
}

.queue-action-button--danger {
  background: rgba(180, 87, 31, 0.1);
  color: #8a3d19;
}

.ordered-by-button:disabled,
.queue-action-button:disabled,
.queue-select:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.ordered-by-button {
  justify-content: center;
  min-width: 150px;
  background: rgba(36, 95, 97, 0.08);
  color: var(--teal);
  font-size: 0.84rem;
}

.details-toggle__chevron {
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  transition: transform 180ms ease;
}

.details-toggle[aria-expanded="true"] .details-toggle__chevron {
  transform: rotate(-135deg) translateY(-1px);
}

.queue-details-row td {
  padding-top: 0;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.details-card {
  min-width: 260px;
  margin-left: auto;
  max-width: 720px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px 18px 16px;
}

.details-card dl {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(120px, 0.9fr) 1.1fr;
  gap: 8px 12px;
}

.details-card dt {
  font-weight: 700;
  color: var(--muted);
}

.details-card dd {
  margin: 0;
  word-break: break-word;
}

.history-panel {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.history-panel h3 {
  margin: 0 0 12px;
  font-family: "Space Grotesk", sans-serif;
}

.history-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding-left: 20px;
}

.history-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.history-item div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.history-item span,
.history-item p,
.history-item li {
  color: var(--muted);
  font-size: 0.88rem;
}

.history-item p {
  margin: 8px 0;
}

.history-item ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.empty-state {
  padding: 26px;
  text-align: center;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .hero,
  .panel__header,
  .intro-grid,
  .user-form,
  .dynamic-fields,
  .form-section__grid {
    grid-template-columns: 1fr;
  }

  .hero,
  .panel__header {
    display: grid;
  }

  .hero__copy h1 {
    max-width: none;
  }

  .panel__header--queue {
    align-items: flex-start;
  }

  .form-section__header {
    flex-direction: column;
  }
}

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

  .hero__copy,
  .hero__stats,
  .panel {
    padding: 20px;
  }

  .form-section {
    padding: 18px;
    border-radius: 20px;
  }

  .top-nav,
  .service-switch,
  .filter-group,
  .account-bar,
  .form-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .top-nav__link,
  .service-switch__button,
  .filter-chip,
  .button {
    flex: 1 1 140px;
  }

  .queue-table {
    min-width: 920px;
  }
}
