:root {
  --bg: #f9fafb;
  --surface: #ffffff;
  --surface-muted: #eef2f7;
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.12);
  --text: #0f172a;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.1);
  --accent-hover: #1d4ed8;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
  --shadow-card: 0 2px 12px rgba(15, 23, 42, 0.05);
  --header-h: 56px;
  --bottom-nav-h: 62px;
  --footer-dock-h: 158px;
  font-family: "Inter", "Be Vietnam Pro", "Segoe UI", system-ui, -apple-system, sans-serif;
}

@media (min-width: 640px) {
  :root {
    --footer-dock-h: 136px;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 20px 36px;
}

/* Chân trang cố định sát đáy — chừa chỗ trong .shell */
body.has-app-footer-dock .shell {
  padding-bottom: calc(var(--footer-dock-h) + 20px + env(safe-area-inset-bottom, 0px));
}

body.has-app-footer-dock.has-bottom-nav .shell {
  padding-bottom: calc(var(--bottom-nav-h) + var(--footer-dock-h) + 20px + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 769px) {
  body.has-app-footer-dock.has-bottom-nav .shell {
    padding-bottom: calc(var(--footer-dock-h) + 24px + env(safe-area-inset-bottom, 0px));
  }
}

body.auth-split-body.has-app-footer-dock .auth-split-viewport {
  padding-bottom: calc(24px + var(--footer-dock-h) + env(safe-area-inset-bottom, 0px));
}

/* —— Header (trên cùng, sticky) —— */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  margin: -16px -16px 16px;
  padding: 8px 16px;
  padding-top: calc(8px + env(safe-area-inset-top, 0px));
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.app-header__main {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--header-h);
}

.app-header__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  text-decoration: none;
}

.app-header__brand:hover {
  text-decoration: none;
  color: var(--accent);
}

.app-header__brand-text {
  letter-spacing: -0.02em;
}

.nav-desktop {
  display: none;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.nav-desktop a {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}

.nav-desktop a:hover {
  background: var(--surface-muted);
  color: var(--text);
  text-decoration: none;
}

.nav-desktop a.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-guest {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-guest-links {
  margin-left: auto;
  margin-right: 4px;
}

.nav-guest a {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}

.nav-guest a:hover {
  background: var(--surface-muted);
  color: var(--text);
  text-decoration: none;
}

@media (max-width: 768px) {
  .nav-desktop.nav-admin-bar {
    display: flex !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: calc(100vw - 100px);
    flex-wrap: nowrap;
    gap: 4px;
    scrollbar-width: none;
  }

  .nav-desktop.nav-admin-bar::-webkit-scrollbar {
    display: none;
  }

  .nav-desktop.nav-admin-bar a {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 8px 12px;
    font-size: 13px;
  }
}

@media (min-width: 769px) {
  .nav-desktop {
    display: flex;
  }
}

@media (max-width: 768px) {
  .nav-guest-links {
    display: none !important;
  }
}

.header-avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(145deg, #93c5fd, #a5b4fc);
  color: #1e3a8a;
  font-weight: 800;
  font-size: 15px;
  flex-shrink: 0;
  text-decoration: none;
}

.header-avatar:hover {
  text-decoration: none;
  filter: brightness(1.03);
}

@media (min-width: 769px) {
  .header-avatar {
    display: none;
  }
}

.header-logout {
  margin: 0;
}

@media (max-width: 768px) {
  .header-logout.nav-desktop {
    display: none;
  }
}

.main-content {
  min-height: 40vh;
}

/* —— Site footer —— */
.site-footer {
  margin-top: 40px;
  padding: 24px 0 12px;
  border-top: 1px solid var(--border);
}

.site-footer--dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  margin-top: 0;
  padding: 12px 16px 10px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 30px rgba(15, 23, 42, 0.06);
}

body.has-bottom-nav .site-footer--dock {
  bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 769px) {
  body.has-bottom-nav .site-footer--dock {
    bottom: 0;
  }
}

.site-footer--dock .site-footer__top {
  margin-bottom: 10px;
}

.site-footer--dock .site-footer__nav {
  margin-bottom: 6px;
}

.site-footer--dock .site-footer__tagline {
  font-size: 13px;
}

.site-footer__inner {
  max-width: 1080px;
  margin: 0 auto;
}

.site-footer__top {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}

@media (min-width: 640px) {
  .site-footer__top {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
  }
}

.site-footer__brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 16px;
}

.site-footer__brand:hover {
  color: var(--accent);
  text-decoration: none;
}

.site-footer__tagline {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
  max-width: 340px;
}

.site-footer__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-bottom: 16px;
  font-size: 14px;
}

.site-footer__nav a {
  font-weight: 600;
  text-decoration: none;
}

.site-footer__nav a:hover {
  text-decoration: underline;
}

.site-footer__copy {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

/* —— Bottom navigation (mobile) —— */
.bottom-nav {
  display: flex;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 30px rgba(15, 23, 42, 0.06);
}

.bottom-nav__link {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 2px;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-decoration: none;
  border-radius: 10px;
}

.bottom-nav__link:hover {
  color: var(--accent);
  text-decoration: none;
  background: var(--surface-muted);
}

.bottom-nav__link.is-active {
  color: var(--accent);
}

.bottom-nav__icon {
  opacity: 0.85;
}

.bottom-nav__link.is-active .bottom-nav__icon {
  opacity: 1;
  stroke: var(--accent);
}

@media (min-width: 769px) {
  .bottom-nav {
    display: none !important;
  }
}

/* —— Cards & layout —— */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-card);
}

.card h2,
.card h3 {
  margin-top: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.card h2 {
  margin-bottom: 8px;
}

.muted {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.grid {
  display: grid;
  gap: 14px;
}

@media (min-width: 900px) {
  .grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }

  .grid.cols-4 {
    grid-template-columns: repeat(4, 1fr);
  }

  .pay-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.stat {
  padding: 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
}

.stat__head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat__icon {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.stat--warning .stat__icon {
  color: #b45309;
  background: #fffbeb;
}

.stat--success .stat__icon {
  color: #047857;
  background: #ecfdf5;
}

.stat--danger .stat__icon {
  color: #b91c1c;
  background: #fef2f2;
}

.stat .label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.stat .value {
  font-size: 26px;
  font-weight: 800;
  margin-top: 6px;
  letter-spacing: -0.03em;
}

.empty-state {
  padding: 20px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  border: 1px dashed var(--border-strong);
  text-align: center;
}

/* —— Buttons —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 700;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s, border-color 0.15s;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-ghost {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-secondary {
  background: #eff6ff;
  border-color: rgba(37, 99, 235, 0.2);
  color: var(--accent);
}

.btn-secondary:hover:not(:disabled) {
  background: #dbeafe;
}

.btn-danger {
  background: #fef2f2;
  border-color: rgba(220, 38, 38, 0.25);
  color: var(--danger);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
}

/* —— Payment segmented —— */
.segmented {
  display: flex;
  gap: 8px;
  padding: 4px;
  background: var(--surface-muted);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.segmented__item {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.segmented__item input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.segmented__item.is-selected {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-card);
}

.pay-highlight {
  font-size: 17px;
  color: var(--text);
}

.pay-code {
  display: inline-block;
  margin-top: 4px;
  padding: 10px 12px;
  background: var(--surface-muted);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 13px;
  word-break: break-all;
  color: var(--text);
}

/* —— Tables —— */
.table-wrap {
  overflow: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

th {
  color: var(--muted);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--surface-muted);
}

tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: #f8fafc;
}

/* —— Forms —— */
.form-row {
  margin-bottom: 14px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
}

textarea {
  min-height: 100px;
  resize: vertical;
}

.help {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

/* —— Alerts —— */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 14px;
}

.alert-success {
  border: 1px solid rgba(5, 150, 105, 0.25);
  background: #ecfdf5;
  color: #065f46;
}

.alert-error {
  border: 1px solid rgba(220, 38, 38, 0.22);
  background: #fef2f2;
  color: #991b1b;
}

.alert-warning {
  background: #fffbeb;
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #92400e;
}

.alert-info {
  border: 1px solid rgba(37, 99, 235, 0.22);
  background: #eff6ff;
  color: #1e40af;
}

.error-text {
  color: var(--danger);
  font-size: 13px;
  margin-top: 6px;
}

/* —— Status badges —— */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-pending {
  background: #fffbeb;
  color: #b45309;
}

.status-paid {
  background: #eff6ff;
  color: #1d4ed8;
}

.status-completed {
  background: #ecfdf5;
  color: #047857;
}

.status-disputed {
  background: #fef2f2;
  color: #b91c1c;
}

.status-resolved {
  background: #f1f5f9;
  color: #475569;
}

.status-cancelled {
  background: #f4f4f5;
  color: #71717a;
}

/* —— Dashboard (fintech style) —— */
.dashboard-hero {
  margin-bottom: 18px;
}

.dashboard-title {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.dashboard-subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  max-width: 760px;
  line-height: 1.6;
  font-size: 15px;
}

.dashboard-stats {
  margin-bottom: 16px;
}

.trust-strip {
  display: grid;
  gap: 14px;
}

.trust-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow-card);
}

.trust-card__img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: contain;
  object-position: center;
  display: block;
  background: #fff;
}

.dashboard-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.dashboard-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.dashboard-empty {
  margin-top: 16px;
}

.dashboard-table {
  margin-top: 16px;
}

@media (min-width: 900px) {
  .trust-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* —— Chat —— */
.chat-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  min-height: 240px;
  max-height: 400px;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bubble {
  max-width: 88%;
  padding: 11px 13px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  box-shadow: var(--shadow-card);
}

.bubble.me {
  align-self: flex-end;
  border-color: rgba(37, 99, 235, 0.22);
  background: var(--accent-soft);
}

.bubble .meta {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 600;
}

.chat-form {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

/* —— Auth —— */
.auth-panel {
  max-width: 420px;
  margin: 48px auto;
}

.auth-panel .card {
  padding: 28px;
}

@media (max-width: 480px) {
  .auth-panel {
    margin: 24px auto;
  }
}

.auth-panel--split {
  max-width: none;
  margin: 0;
  width: 100%;
}

.auth-panel--split .card {
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

/* —— Auth split (login / register marketing column) —— */
.auth-split-body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: linear-gradient(165deg, #e8f1fb 0%, #f1f5f9 42%, #ffffff 100%);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
}

.auth-split-viewport {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 20px 32px;
  box-sizing: border-box;
}

.auth-split-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.auth-split-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--text);
  text-decoration: none;
}

.auth-split-brand:hover {
  color: var(--accent);
  text-decoration: none;
}

.auth-split-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-split-nav__current {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.auth-split {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: stretch;
}

.auth-split__banner {
  order: 1;
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.1);
  background: linear-gradient(180deg, #f1f5f9 0%, #e8eef5 100%);
}

.auth-split__banner-img {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  object-position: center;
}

.auth-split__form {
  order: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
}

@media (min-width: 900px) {
  .auth-split {
    flex-direction: row;
    align-items: flex-start;
    gap: 40px;
  }

  .auth-split__form {
    order: 1;
    flex: 0 1 min(40%, 440px);
    max-width: 440px;
    min-width: 280px;
  }

  .auth-split__banner {
    order: 2;
    flex: 1 1 55%;
    min-width: 0;
    max-width: 60%;
    align-self: flex-start;
  }
}

.role-badge {
  display: none;
}

.pay-deadline-banner {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: #fffbeb;
  border: 1px solid rgba(245, 158, 11, 0.35);
  margin-bottom: 14px;
  font-size: 14px;
  line-height: 1.45;
}

.fee-preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  font-size: 14px;
}

.payout-status {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.payout-status--pending {
  background: #fffbeb;
  color: #b45309;
}

.payout-status--paid {
  background: #ecfdf5;
  color: #047857;
}

.payout-status--reject {
  background: #fef2f2;
  color: #b91c1c;
}
