:root {
  --bg: #f3f8f5;
  --ink: #10251c;
  --muted: #5c6f66;
  --fine: #789086;
  --brand: #008247;
  --brand-dark: #003f29;
  --brand-mid: #00623a;
  --warning: #faa916;
  --danger: #c03639;
  --line: rgba(0, 130, 71, 0.1);
  --line-strong: rgba(0, 130, 71, 0.16);
  --card: rgba(255, 255, 255, 0.94);
  --rpx: 0.5px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
}

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

button {
  border: 0;
  cursor: pointer;
}

.page {
  min-height: 100vh;
  max-width: 540px;
  margin: 0 auto;
  padding: 11px 12px 24px;
  background: var(--bg);
}

.safe-bottom {
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

.login-page {
  padding-top: 36px;
}

.top-panel {
  padding: 15px 14px;
  border-radius: 8px;
  color: #ffffff;
  background: linear-gradient(135deg, #003f29 0%, #00623a 58%, #008247 100%);
  box-shadow: 0 8px 17px rgba(0, 82, 49, 0.12);
}

.title {
  font-size: 19px;
  line-height: 1.25;
  font-weight: 700;
}

.subtitle {
  margin-top: 6px;
  color: rgba(236, 255, 246, 0.78);
  font-size: 12px;
  line-height: 1.5;
}

.card {
  margin-top: 10px;
  padding: 13px;
  border: 1px solid rgba(0, 130, 71, 0.11);
  border-radius: 8px;
  background: var(--card);
  box-shadow: 0 5px 14px rgba(0, 82, 49, 0.06);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
}

.compact-title {
  margin-bottom: 6px;
}

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

.fine {
  color: var(--fine);
  font-size: 12px;
}

.row {
  display: flex;
  align-items: center;
}

.between {
  justify-content: space-between;
}

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

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 7px;
  border: 0;
  color: #ffffff;
  background: var(--brand);
  font-size: 14px;
  line-height: 1;
}

.btn:disabled {
  opacity: 0.58;
}

.btn-secondary {
  color: var(--brand);
  border: 1px solid rgba(0, 130, 71, 0.26);
  background: #edf8f2;
}

.btn-danger {
  color: #ffffff;
  background: var(--danger);
}

.btn-ghost {
  color: #30483c;
  border: 1px solid rgba(0, 130, 71, 0.14);
  background: #ffffff;
}

.field {
  margin-top: 11px;
}

.label {
  margin-bottom: 6px;
  color: #30483c;
  font-size: 12px;
  font-weight: 600;
}

.input,
.textarea,
.picker {
  width: 100%;
  min-height: 41px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #ffffff;
  color: var(--ink);
  font-size: 14px;
  outline: none;
}

.textarea {
  min-height: 75px;
  padding-top: 9px;
  line-height: 1.5;
  resize: vertical;
}

.picker,
select.picker {
  display: flex;
  align-items: center;
  appearance: none;
}

.list-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.list-item:last-child {
  border-bottom: 0;
}

.clickable {
  cursor: pointer;
}

.item-title {
  min-width: 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  word-break: break-word;
}

.item-meta {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  word-break: break-word;
}

.cell-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  padding: 0 11px;
  border-bottom: 1px solid rgba(0, 130, 71, 0.08);
}

.cell:last-child {
  border-bottom: 0;
}

.cell-main {
  min-width: 0;
}

.cell-title {
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
}

.cell-desc {
  margin-top: 3px;
  color: var(--fine);
  font-size: 11.5px;
  line-height: 1.35;
}

.cell-value {
  max-width: 180px;
  color: #30483c;
  font-size: 12.5px;
  text-align: right;
  line-height: 1.35;
}

.priority-card {
  border-color: rgba(250, 169, 22, 0.24);
  background: #fffaf0;
}

.toolbar {
  display: flex;
  gap: 8px;
  margin-top: 11px;
}

.toolbar .btn {
  flex: 1;
}

.bind-btn,
.submit-btn {
  margin-top: 17px;
  width: 100%;
}

.switch-btn,
.small-btn,
.add-btn {
  width: 66px;
  min-height: 32px;
  padding: 0;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
}

.top-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.metrics-strip {
  display: flex;
  gap: 7px;
  margin-top: 11px;
  overflow-x: auto;
  white-space: nowrap;
}

.metric-chip {
  min-width: 77px;
  padding: 10px 9px;
  border: 1px solid rgba(0, 130, 71, 0.11);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 4px 11px rgba(0, 82, 49, 0.05);
}

.metric-value {
  color: var(--brand);
  font-size: 19px;
  line-height: 1;
  font-weight: 800;
}

.metric-label {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.role-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.search-card {
  display: flex;
  gap: 8px;
  padding: 9px;
}

.search-input {
  flex: 1;
}

.search-btn {
  width: 66px;
  min-height: 41px;
}

.tag-row {
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.next-line {
  margin-top: 7px;
  padding: 7px 8px;
  border-radius: 7px;
  color: var(--brand-mid);
  background: #edf8f2;
  font-size: 12px;
  line-height: 1.35;
}

.loading-text {
  padding: 12px 0 2px;
  text-align: center;
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 21px;
  max-width: 120px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}

.tag.primary {
  color: var(--brand-mid);
  background: rgba(0, 130, 71, 0.12);
}

.tag.success {
  color: var(--brand);
  background: rgba(0, 130, 71, 0.1);
}

.tag.warning {
  color: #9a6400;
  background: rgba(250, 169, 22, 0.16);
}

.tag.danger {
  color: var(--danger);
  background: rgba(192, 54, 57, 0.12);
}

.tag.info {
  color: var(--muted);
  background: rgba(92, 111, 102, 0.12);
}

.empty {
  padding: 36px 12px;
  text-align: center;
  color: var(--fine);
}

.mark {
  width: 44px;
  height: 6px;
  margin: 0 auto 14px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--brand), var(--warning));
  opacity: 0.45;
}

.empty-title {
  color: #30483c;
  font-size: 14px;
  font-weight: 700;
}

.empty-desc {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.5;
}

.detail-page {
  padding-top: 7px;
}

.detail-hero {
  padding: 10px 11px 9px;
}

.detail-hero .title {
  font-size: 15.5px;
}

.detail-hero .subtitle {
  margin-top: 3px;
  font-size: 11px;
}

.customer-card {
  margin-top: 7px;
  padding: 8px;
}

.parallel-step {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: 28px 28px;
  margin: 9px 0 0;
}

.parallel-step::before,
.parallel-step::after,
.parallel-join,
.parallel-tail {
  content: "";
  position: absolute;
  height: 2px;
  background: rgba(255, 255, 255, 0.34);
}

.parallel-step::before {
  left: 10%;
  right: 50%;
  top: 5px;
}

.parallel-step::after {
  left: 30%;
  right: 50%;
  top: 33px;
}

.parallel-join {
  left: 50%;
  width: 0;
  top: 5px;
  height: 30px;
}

.parallel-tail {
  left: 50%;
  right: 10%;
  top: 5px;
}

.parallel-step.payment-done::after,
.parallel-step.customer-done::before,
.parallel-step.confirmed .parallel-join,
.parallel-step.brazil-done .parallel-tail {
  background: rgba(255, 255, 255, 0.92);
}

.step-item {
  position: relative;
  min-width: 0;
  text-align: center;
}

.step-dot {
  position: relative;
  z-index: 1;
  width: 11px;
  height: 11px;
  margin: 0 auto;
  border: 2.5px solid #ffffff;
  border-radius: 50%;
  background: #d9e9e1;
  box-shadow: 0 0 0 1px rgba(0, 130, 71, 0.16);
}

.hero-step .step-dot {
  border-color: rgba(0, 112, 62, 0.92);
  background: rgba(255, 255, 255, 0.36);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.62);
}

.step-item.done .step-dot,
.step-item.active .step-dot {
  background: var(--brand);
}

.hero-step .step-item.done .step-dot,
.hero-step .step-item.active .step-dot {
  background: #ffffff;
}

.step-item.active .step-dot {
  box-shadow: 0 0 0 3px rgba(0, 130, 71, 0.13);
  animation: stepPulse 1.4s ease-in-out infinite;
}

.hero-step .step-item.active .step-dot {
  animation: heroStepPulse 1.4s ease-in-out infinite;
}

.step-label {
  margin-top: 3px;
  color: var(--fine);
  font-size: 9.5px;
  line-height: 1.25;
  white-space: nowrap;
  transform: scale(0.92);
  transform-origin: center top;
}

.parallel-step .step-label {
  color: rgba(236, 255, 246, 0.7);
}

.step-item.done .step-label,
.step-item.active .step-label {
  color: var(--brand-mid);
  font-weight: 650;
}

.parallel-step .step-item.done .step-label,
.parallel-step .step-item.active .step-label {
  color: #ffffff;
}

.step-open {
  grid-column: 1;
  grid-row: 1;
}

.step-customer {
  grid-column: 3;
  grid-row: 1;
}

.step-payment {
  grid-column: 2;
  grid-row: 2;
}

.step-confirm {
  grid-column: 4;
  grid-row: 1;
}

.step-brazil {
  grid-column: 5;
  grid-row: 1;
}

.step-done {
  grid-column: 5;
  grid-row: 2;
}

.action-card {
  margin-top: 7px;
  padding: 9px 10px;
}

.action-row {
  display: flex;
  gap: 7px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.action-row .btn {
  flex: 1 1 30%;
  min-height: 38px;
}

.customer-fields .cell {
  align-items: flex-start;
  min-height: 30px;
  padding: 5px 8px;
}

.customer-fields .cell-value {
  max-width: 215px;
  word-break: break-all;
  font-size: 11.5px;
}

.customer-fields .cell-title {
  font-size: 12px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.status-cell {
  min-height: 46px;
  padding: 8px;
  border-radius: 7px;
  background: #edf8f2;
}

.stage {
  margin-top: 10px;
  padding: 10px;
  border-radius: 7px;
  color: #30483c;
  background: #fff8e9;
  line-height: 1.5;
}

.compact-status {
  background: rgba(255, 255, 255, 0.82);
}

.kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(0, 130, 71, 0.08);
  color: #30483c;
}

.kv span:first-child {
  flex-shrink: 0;
  color: var(--fine);
}

.kv span:last-child {
  text-align: right;
  word-break: break-word;
}

.next-hint {
  color: #30483c;
  font-size: 14px;
  line-height: 1.55;
}

.link-box {
  margin-top: 9px;
  padding: 9px;
  border-radius: 4px;
  color: var(--brand-mid);
  background: #edf8f2;
  font-size: 12px;
  line-height: 1.5;
  word-break: break-all;
}

.event {
  display: flex;
  gap: 9px;
  padding: 9px 0;
}

.dot {
  width: 9px;
  height: 9px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--brand);
}

.event-body {
  flex: 1;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(0, 130, 71, 0.08);
}

.mask {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  background: rgba(0, 20, 12, 0.42);
}

.sheet {
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
  padding: 15px 12px calc(17px + env(safe-area-inset-bottom));
  border-radius: 8px 8px 0 0;
  background: #ffffff;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 52px;
  z-index: 90;
  max-width: calc(100vw - 48px);
  transform: translateX(-50%);
  padding: 9px 12px;
  border-radius: 6px;
  color: #ffffff;
  background: rgba(16, 37, 28, 0.92);
  font-size: 13px;
  line-height: 1.35;
}

.loading-mask,
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 20, 12, 0.18);
}

.loading-box,
.modal-box {
  width: min(310px, calc(100vw - 48px));
  padding: 18px;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 16px 34px rgba(0, 82, 49, 0.18);
  text-align: center;
}

.loading-spinner {
  width: 28px;
  height: 28px;
  margin: 0 auto 10px;
  border: 3px solid #d9e9e1;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
}

.modal-content {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.55;
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.modal-actions .btn {
  flex: 1;
}

.hidden {
  display: none !important;
}

.nav-card {
  display: flex;
  gap: 8px;
}

.nav-card .btn {
  flex: 1;
}

@keyframes stepPulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(0, 130, 71, 0.14); }
  50% { box-shadow: 0 0 0 6px rgba(0, 130, 71, 0.02); }
}

@keyframes heroStepPulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.24); }
  50% { box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.04); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 360px) {
  .grid-2,
  .status-grid {
    grid-template-columns: 1fr;
  }

  .action-row .btn {
    flex-basis: 100%;
  }
}
