.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 8px 12px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.btn:hover {
  background: var(--sand);
}

.btn--primary {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.btn--primary:hover {
  background: var(--teal-hover);
}

.btn--ink {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

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

.btn--ghost {
  background: transparent;
}

.btn--sm {
  padding: 5px 9px;
  font-size: 12px;
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card__head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.card__body {
  padding: 16px;
}

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

.kpi {
  padding: 14px 16px;
  cursor: pointer;
}

.kpi:hover {
  border-color: var(--teal);
}

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

.kpi__value {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  margin: 6px 0 4px;
}

.kpi__hint {
  font-size: 12px;
  color: var(--text-soft);
}

.kpi.is-warn {
  border-color: #f5c9a8;
  background: linear-gradient(#fff, var(--warning-soft));
}

.kpi.is-danger {
  border-color: #f0b4b0;
  background: linear-gradient(#fff, var(--danger-soft));
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  background: var(--sand-2);
  color: var(--ink);
  white-space: nowrap;
}

.badge--blue {
  background: var(--info-soft);
  color: var(--info);
}
.badge--amber {
  background: var(--warning-soft);
  color: var(--warning);
}
.badge--green {
  background: var(--success-soft);
  color: var(--success);
}
.badge--red {
  background: var(--danger-soft);
  color: var(--danger);
}
.badge--teal {
  background: var(--teal-soft);
  color: var(--teal);
}
.badge--gold {
  background: var(--gold-soft);
  color: #8a5a12;
}
.badge--muted {
  background: var(--sand);
  color: var(--muted);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.table {
  min-width: 720px;
}

.table th,
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

.table th {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  background: #faf8f4;
}

.table tr:last-child td {
  border-bottom: 0;
}

.table tbody tr:hover {
  background: #faf8f4;
}

.table .is-overdue,
.table .is-overdue td {
  background: var(--danger-soft);
}

.linkish {
  color: var(--teal);
  font-weight: 650;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

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

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  overflow: auto;
}

.tab {
  border: 0;
  background: none;
  padding: 8px 12px;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab.is-on {
  color: var(--ink);
  border-bottom-color: var(--teal);
}

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

.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
}

.field input,
.field select,
.textarea,
.field textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
}

.grid-2,
.grid-3,
.grid-4 {
  display: grid;
  gap: 12px;
}

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

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.search-box {
  min-width: 220px;
  flex: 1;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(8, minmax(210px, 1fr));
  gap: 10px;
  overflow: auto;
  padding-bottom: 8px;
}

.kanban__col {
  background: #efebe3;
  border-radius: 12px;
  padding: 10px;
  min-height: 280px;
}

.kanban__title {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}

.lead-card {
  background: #fff;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  cursor: grab;
  box-shadow: var(--shadow-sm);
}

.lead-card.is-hero {
  border-color: var(--teal);
  box-shadow: 0 0 0 1px var(--teal);
}

.lead-card small {
  color: var(--muted);
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.tl-item {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 12px;
}

.tl-item__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--teal);
  margin-top: 6px;
  position: relative;
}

.tl-item__dot::after {
  content: "";
  position: absolute;
  top: 14px;
  right: 5px;
  width: 2px;
  height: calc(100% + 18px);
  background: var(--stone);
}

.tl-item:last-child .tl-item__dot::after {
  display: none;
}

.tl-item__body {
  padding-bottom: 16px;
}

.tl-item time {
  color: var(--muted);
  font-size: 12px;
}

.stepper {
  display: flex;
  gap: 0;
  overflow: auto;
  padding: 6px 0 16px;
}

.step {
  flex: 1;
  min-width: 110px;
  text-align: center;
  position: relative;
  font-size: 11px;
  color: var(--muted);
}

.step::before {
  content: "";
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin: 0 auto 8px;
  background: var(--stone);
  border: 2px solid var(--stone);
}

.step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 5px;
  left: 0;
  right: 50%;
  margin-right: 10px;
  height: 2px;
  background: var(--stone);
}

.step + .step::after {
  right: 50%;
  left: -50%;
  margin-right: 10px;
  margin-left: 10px;
}

.step.is-done {
  color: var(--success);
  font-weight: 700;
}
.step.is-done::before {
  background: var(--success);
  border-color: var(--success);
}
.step.is-on {
  color: var(--teal);
  font-weight: 700;
}
.step.is-on::before {
  background: #fff;
  border-color: var(--teal);
}

.progress {
  height: 8px;
  background: var(--sand-2);
  border-radius: 99px;
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  background: var(--teal);
}

.split {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 16px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.warn-row {
  color: var(--danger);
  font-weight: 700;
}

.restricted {
  filter: blur(4px);
  user-select: none;
  pointer-events: none;
}

.restricted-wrap {
  position: relative;
}

.restricted-wrap .lock-note {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 2;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
  padding: 12px;
}

.empty {
  padding: 32px;
  text-align: center;
  color: var(--muted);
}

.otp-box {
  display: flex;
  gap: 8px;
  justify-content: center;
  direction: ltr;
}

.otp-box input {
  width: 44px;
  height: 48px;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.legal {
  background: var(--sand);
  border-radius: 10px;
  padding: 12px;
  font-size: 12px;
  max-height: 180px;
  overflow: auto;
}

.alert-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alert {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
}

.alert--red {
  background: var(--danger-soft);
  border-color: #f0b4b0;
}
.alert--amber {
  background: var(--warning-soft);
  border-color: #f5c9a8;
}

.chart-box {
  height: 220px;
  position: relative;
}

.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 4px;
  color: var(--muted);
  font-size: 12px;
}

.matrix {
  overflow: auto;
}

.matrix table th,
.matrix table td {
  text-align: center;
  min-width: 88px;
}

.matrix table th:first-child,
.matrix table td:first-child {
  text-align: right;
  position: sticky;
  right: 0;
  background: #fff;
}

.prod-col.is-late {
  background: #fde8e6;
}

.sms-preview {
  background: #14332a;
  color: #eaf6ef;
  border-radius: 16px;
  padding: 16px;
  max-width: 280px;
}

.portal-hero {
  background: linear-gradient(160deg, #14332a, #2a6b4f);
  color: #fff;
  border-radius: 18px;
  padding: 22px;
}

.portal-steps {
  display: grid;
  gap: 8px;
}

.portal-steps li {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}

.dot-on {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--teal);
}
.dot-wait {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--stone);
}

@media (max-width: 1440px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .split,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
  .kpi-grid,
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .kpi-grid,
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .table {
    min-width: 640px;
  }
}
