:root {
  color-scheme: light;
  --bg: #f5f6f1;
  --surface: #ffffff;
  --surface-2: #eef3ee;
  --ink: #17201a;
  --muted: #67716b;
  --line: #dfe5dd;
  --green: #28714d;
  --green-dark: #195436;
  --blue: #245c85;
  --amber: #9a6714;
  --red: #a83b39;
  --shadow: 0 16px 40px rgba(19, 33, 24, 0.1);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  background: #13231b;
  color: #eef7f0;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

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

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e0f1ca;
  color: #13231b;
  font-weight: 800;
}

.brand strong {
  display: block;
  font-size: 18px;
}

.brand span,
.role-panel label {
  color: #b7c8bd;
  font-size: 13px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item,
.ghost-button,
.primary-button,
.icon-button,
.tab,
.action-button {
  border: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
}

.nav-item {
  width: 100%;
  justify-content: flex-start;
  padding: 11px 12px;
  color: #d8e4dc;
  background: transparent;
}

.nav-item.is-active,
.nav-item:hover {
  background: #203d2f;
  color: #ffffff;
}

i[data-lucide] {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.role-panel {
  margin-top: auto;
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.role-panel select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
  background: #1b3427;
  border-radius: 8px;
  padding: 10px;
}

.workspace {
  padding: 28px;
  display: grid;
  gap: 22px;
  align-content: start;
}

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

.eyebrow {
  margin: 0 0 5px;
  color: var(--green);
  text-transform: uppercase;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(26px, 4vw, 40px);
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 6px;
  font-size: 20px;
}

h3 {
  margin-bottom: 8px;
  font-size: 16px;
}

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

.ghost-button {
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
}

.primary-button,
.action-button.primary {
  padding: 0 15px;
  background: var(--green);
  color: white;
}

.primary-button:hover,
.action-button.primary:hover {
  background: var(--green-dark);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 12px;
}

.metrics article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metrics strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  line-height: 1;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 16px;
  align-items: start;
}

.queue-panel,
.detail-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.queue-panel {
  min-width: 0;
}

.panel-head {
  padding: 18px;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
}

.panel-head p {
  margin-bottom: 0;
  color: var(--muted);
}

.search-box {
  min-width: 260px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: #fbfcfa;
  border-radius: 8px;
  padding: 0 12px;
  height: 42px;
}

.search-box input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

.status-tabs {
  padding: 12px 18px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}

.tab {
  padding: 0 12px;
  background: #f4f6f2;
  color: var(--muted);
  white-space: nowrap;
}

.tab.is-active {
  background: #dfeee2;
  color: var(--green-dark);
  font-weight: 750;
}

.order-list {
  display: grid;
}

.order-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.2fr) 110px 120px 130px;
  gap: 14px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  text-align: left;
}

.order-row:hover,
.order-row.is-selected {
  background: #f5faf4;
}

.customer {
  display: grid;
  gap: 3px;
}

.customer strong {
  overflow-wrap: anywhere;
}

.meta,
.small {
  color: var(--muted);
  font-size: 13px;
}

.amount {
  font-weight: 800;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  width: max-content;
  max-width: 100%;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
  background: #edf0ed;
  color: #4d5850;
}

.badge.new {
  background: #fff1d2;
  color: var(--amber);
}

.badge.paid {
  background: #dff0ff;
  color: var(--blue);
}

.badge.done {
  background: #ddf2e7;
  color: var(--green-dark);
}

.badge.issue {
  background: #ffe1df;
  color: var(--red);
}

.detail-panel {
  position: sticky;
  top: 20px;
  min-height: 510px;
  padding: 18px;
}

.empty-state {
  min-height: 450px;
  display: grid;
  place-items: center;
  align-content: center;
  color: var(--muted);
  text-align: center;
  gap: 8px;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.detail-head p {
  margin-bottom: 0;
}

.detail-section {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-top: 16px;
}

.kv {
  display: grid;
  grid-template-columns: 105px minmax(0, 1fr);
  gap: 9px;
  margin: 8px 0;
}

.kv span:first-child {
  color: var(--muted);
}

.timeline {
  display: grid;
  gap: 10px;
}

.step {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 9px;
  color: var(--muted);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin: 6px auto 0;
  background: #c6cec8;
}

.step.is-done {
  color: var(--ink);
}

.step.is-done .dot {
  background: var(--green);
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.action-button {
  min-height: 42px;
  padding: 0 12px;
  background: var(--surface-2);
  color: var(--ink);
}

.action-button.warn {
  background: #ffe1df;
  color: var(--red);
}

.reply-box {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbf8;
  padding: 12px;
  min-height: 92px;
  resize: vertical;
}

dialog {
  border: 0;
  border-radius: 8px;
  padding: 0;
  width: min(680px, calc(100vw - 28px));
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.24);
}

dialog::backdrop {
  background: rgba(18, 27, 20, 0.45);
}

.modal {
  padding: 20px;
}

.modal-head,
.modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.icon-button {
  width: 38px;
  height: 38px;
  background: #f1f4ef;
  color: var(--ink);
}

.form-grid {
  margin: 18px 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.form-grid input,
.form-grid textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--ink);
  background: #fbfcfa;
}

.modal-actions {
  justify-content: flex-end;
}

@media (max-width: 1050px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .nav-list {
    display: flex;
    overflow-x: auto;
    flex: 1 1 420px;
  }

  .nav-item {
    width: auto;
    white-space: nowrap;
  }

  .role-panel {
    margin-left: auto;
    margin-top: 0;
  }

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

  .detail-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .workspace {
    padding: 18px;
  }

  .topbar,
  .panel-head {
    display: grid;
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .topbar-actions > button {
    flex: 1;
  }

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

  .search-box {
    min-width: 0;
    width: 100%;
  }

  .order-row {
    grid-template-columns: 1fr 90px;
  }

  .order-row .hide-mobile {
    display: none;
  }

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