/* Reset & base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f6fa;
  color: #2d3436;
  line-height: 1.6;
}

/* Container */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* Nav */
.nav {
  background: #fff;
  border-bottom: 1px solid #dfe6e9;
  padding: 0 16px;
}
.nav__inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.nav__logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}
.nav__logo-img {
  height: 16px;
  width: auto;
}
.nav__right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.nav__user { font-size: 14px; color: #636e72; }
.nav__link {
  font-size: 14px;
  color: #0984e3;
  text-decoration: none;
}
.nav__link:hover { text-decoration: underline; }
.nav__logout-form { display: inline; }
.nav__logout-btn {
  background: none;
  border: none;
  color: #d63031;
  cursor: pointer;
  font-size: 14px;
}

/* Flash messages */
.flash {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 14px;
}
.flash--error { background: #ffeaea; color: #d63031; border: 1px solid #fab1a0; }
.flash--success { background: #eafff1; color: #00b894; border: 1px solid #55efc4; }

/* Auth pages */
.auth-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 48px);
}
.auth-card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}
.auth-card--wide { max-width: 640px; }
.auth-card h1 { margin-bottom: 4px; font-size: 24px; }
.auth-subtitle { color: #636e72; margin-bottom: 24px; font-size: 14px; }
.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-logo__img { max-width: 180px; height: auto; margin-bottom: 8px; }
.auth-logo__text { color: #636e72; font-size: 14px; }
.auth-register-title { font-size: 20px; margin-bottom: 16px; }
.auth-footer { text-align: center; margin-top: 16px; font-size: 14px; }
.auth-footer a { color: #0984e3; }

/* Form */
.form { display: flex; flex-direction: column; gap: 16px; }
.form__group { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.form__group label { font-size: 13px; font-weight: 600; color: #636e72; }
.form__group input,
.form__group select,
.form__group textarea {
  padding: 10px 12px;
  border: 1px solid #dfe6e9;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.15s;
}
.form__group input:focus,
.form__group select:focus,
.form__group textarea:focus {
  outline: none;
  border-color: #0984e3;
}
.form__row { display: flex; gap: 16px; }
.form__divider { border: none; border-top: 1px solid #dfe6e9; margin: 8px 0; }
.form__section { background: #fff; border-radius: 8px; padding: 24px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.form__section-title { font-size: 16px; margin-bottom: 16px; color: #2d3436; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}
.btn--primary { background: #0984e3; color: #fff; }
.btn--primary:hover { background: #0770c2; }
.btn--secondary { background: #dfe6e9; color: #2d3436; }
.btn--secondary:hover { background: #c8d6db; }
.btn--danger { background: #d63031; color: #fff; }
.btn--danger:hover { background: #b71c1c; }
.btn--full { width: 100%; }
.btn--sm { padding: 6px 12px; font-size: 13px; }

/* Dashboard */
.dashboard__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.dashboard__header h1 { font-size: 22px; }

/* Table */
.table-wrapper { background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 13px;
  color: #636e72;
  background: #f5f6fa;
  border-bottom: 1px solid #dfe6e9;
}
.table td { padding: 12px 16px; font-size: 14px; border-bottom: 1px solid #f0f0f0; }
.table tr:last-child td { border-bottom: none; }

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.badge--created { background: #dfe6e9; color: #2d3436; }
.badge--pending { background: #ffeaa7; color: #856404; }
.badge--error { background: #ffeaea; color: #d63031; }
.badge--processing { background: #81ecec; color: #00696a; }
.badge--shipping { background: #74b9ff; color: #0251a1; }
.badge--delivered { background: #55efc4; color: #006b4f; }
.badge--cancelled { background: #fab1a0; color: #7c1616; }
.badge--pending-confirmation { background: #fdcb6e; color: #6c5400; }
.badge--default { background: #dfe6e9; color: #636e72; }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; background: #fff; border-radius: 8px; }
.empty-state p { color: #636e72; margin-bottom: 16px; }

/* Order summary */
.order-summary {
  background: #fff;
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.order-summary h3 { margin-bottom: 12px; font-size: 16px; }
.summary__row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; }
.summary__row--total { border-top: 1px solid #dfe6e9; margin-top: 8px; padding-top: 12px; font-weight: 700; font-size: 16px; }
.summary__row--commission { margin-top: 8px; padding-top: 8px; border-top: 1px solid #55efc4; color: #00b894; font-weight: 600; }

/* Commission */
.commission-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #eafff1;
  border: 1px solid #55efc4;
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 16px;
}
.commission-summary__label { font-size: 15px; color: #2d3436; }
.commission-summary__value { font-size: 20px; font-weight: 700; color: #00b894; }
.commission-cell { color: #00b894; font-weight: 600; }
.commission-cell--zero { color: #b2bec3; }

/* Commission cards */
.commission-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.commission-card {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  border-left: 4px solid #dfe6e9;
}
.commission-card--payable { border-left-color: #00b894; }
.commission-card--pending { border-left-color: #fdcb6e; }
.commission-card--paid { border-left-color: #0984e3; }
.commission-card__label { display: block; font-size: 13px; color: #636e72; margin-bottom: 4px; }
.commission-card__value { display: block; font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.commission-card--payable .commission-card__value { color: #00b894; }
.commission-card--pending .commission-card__value { color: #856404; }
.commission-card--paid .commission-card__value { color: #0984e3; }
.commission-card__note { display: block; font-size: 12px; color: #b2bec3; }

/* Payout action */
.payout-action {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

/* Invoices page */
.invoices-page h1 {
  font-size: 22px;
  margin-bottom: 24px;
}

/* Payout detail */
.payout-detail { display: flex; flex-direction: column; gap: 16px; }
.payout-detail__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.payout-detail__header h1 { font-size: 22px; }
.payout-instructions ol {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 14px;
  line-height: 1.6;
}
.payout-instructions a { color: #0984e3; }

/* Commission badges */
.cbadge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
  vertical-align: middle;
}
.cbadge--pending { background: #ffeaa7; color: #856404; }
.cbadge--payable { background: #55efc4; color: #006b4f; }
.cbadge--paid { background: #74b9ff; color: #0251a1; }
.cbadge--cancelled { background: #fab1a0; color: #7c1616; }

/* Product rows */
.product-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}
.product-row select { flex: 2; }
.product-row input[type="number"] { width: 80px; }
.product-row .product-price { font-size: 14px; min-width: 80px; text-align: right; padding-bottom: 10px; }

/* Create order page */
.create-order { display: flex; flex-direction: column; gap: 20px; }
.create-order .form { gap: 20px; }

/* Order detail */
.order-detail { display: flex; flex-direction: column; gap: 16px; }
.order-detail__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.order-detail__header h1 { font-size: 22px; margin-bottom: 4px; }
.order-detail__date { font-size: 14px; color: #636e72; }
.order-detail__status { padding-top: 4px; }
.order-link { color: #0984e3; text-decoration: none; font-weight: 600; }
.order-link:hover { text-decoration: underline; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail-card {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.detail-card h3 { font-size: 15px; margin-bottom: 12px; color: #636e72; }
.detail-card p { font-size: 14px; margin-bottom: 4px; }
.detail-note { color: #636e72; font-style: italic; margin-top: 8px; }
.detail-totals { padding-top: 12px; }

/* Timeline */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline__item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-left: 2px solid #dfe6e9;
  margin-left: 7px;
  padding-left: 20px;
  position: relative;
}
.timeline__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #dfe6e9;
  position: absolute;
  left: -7px;
  top: 12px;
}
.timeline__item--success .timeline__dot { background: #00b894; }
.timeline__item--error .timeline__dot { background: #d63031; }
.timeline__content { display: flex; flex-direction: column; }
.timeline__message { font-size: 14px; }
.timeline__date { font-size: 12px; color: #636e72; }

/* Responsive */
@media (max-width: 640px) {
  .form__row { flex-direction: column; }
  .nav__right { gap: 8px; }
  .dashboard__header { flex-direction: column; gap: 12px; align-items: flex-start; }
  .commission-cards { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}
