:root {
  --app-primary: #2563eb;
  --app-primary-dark: #1d4ed8;
  --app-navy: #0f172a;
  --app-muted: #64748b;
  --app-border: #e2e8f0;
  --app-surface: #fff;
  --app-background: #f4f7fb;
  --app-radius: 14px;
  --app-shadow: 0 10px 30px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }
body { display: flex; flex-direction: column; min-height: 100vh; background: var(--app-background); color: var(--app-navy); font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
a { text-underline-offset: 3px; }
.app-main { flex: 1 0 auto; padding-top: 2rem; padding-bottom: 3rem; }

.app-footer { flex: 0 0 auto; border-top: 1px solid var(--app-border); background: rgba(255, 255, 255, .72); }
.app-footer-content { display: flex; align-items: center; justify-content: center; gap: .65rem; min-height: 54px; padding-top: .75rem; padding-bottom: .75rem; color: var(--app-muted); font-size: .78rem; }
.app-filing-link { display: inline-flex; align-items: center; gap: .38rem; color: inherit; text-decoration: none; transition: color .18s ease; }
.app-filing-link:hover, .app-filing-link:focus-visible { color: var(--app-primary); text-decoration: underline; }
.app-filing-link img { flex: 0 0 auto; }
.app-footer-separator { color: #cbd5e1; }

.app-navbar { min-height: 68px; background: linear-gradient(110deg, #0f172a 0%, #172554 55%, #1e3a8a 100%); border-bottom: 1px solid rgba(255, 255, 255, .1); box-shadow: 0 8px 24px rgba(15, 23, 42, .16); }
.app-brand { display: inline-flex; align-items: center; gap: .7rem; margin-right: 2rem; color: #fff; line-height: 1.05; }
.app-brand:hover { color: #fff; }
.app-brand strong { display: block; font-size: 1rem; letter-spacing: .02em; }
.app-brand small { display: block; margin-top: .28rem; color: #94a3b8; font-size: .58rem; letter-spacing: .13em; text-transform: uppercase; }
.app-brand-mark { display: inline-grid; place-items: center; flex: 0 0 auto; color: #fff; background: linear-gradient(145deg, #3b82f6, #1d4ed8); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 6px 16px rgba(37, 99, 235, .25); }
.app-brand-mark { width: 36px; height: 36px; border-radius: 10px; font-size: .95rem; font-weight: 800; }

.app-nav-links { gap: .15rem; }
.app-nav-links .nav-link { position: relative; padding: .55rem .72rem; border-radius: 9px; color: #cbd5e1; font-size: .9rem; font-weight: 500; transition: color .18s ease, background-color .18s ease; }
.app-nav-links .nav-link:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.app-nav-links .nav-link.active { color: #fff; background: rgba(59, 130, 246, .28); }
.app-nav-links .app-nav-highlight::after { content: ""; position: absolute; top: .46rem; right: .4rem; width: 5px; height: 5px; border-radius: 50%; background: #fbbf24; box-shadow: 0 0 0 3px rgba(251, 191, 36, .12); }
.app-user-area { display: flex; align-items: center; gap: .65rem; padding-left: 1rem; border-left: 1px solid rgba(255, 255, 255, .12); }
.app-user-avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 255, 255, .13); color: #dbeafe; font-weight: 700; }
.app-user-copy { min-width: 66px; line-height: 1.1; }
.app-user-copy strong { display: block; max-width: 120px; overflow: hidden; color: #f8fafc; font-size: .82rem; text-overflow: ellipsis; white-space: nowrap; }
.app-user-copy small { display: block; margin-top: .25rem; color: #94a3b8; font-size: .68rem; }
.app-logout-btn { border: 1px solid rgba(255, 255, 255, .24); color: #e2e8f0; background: transparent; }
.app-logout-btn:hover { border-color: rgba(255, 255, 255, .45); color: #fff; background: rgba(255, 255, 255, .1); }
.navbar-toggler { border-color: rgba(255, 255, 255, .2); }
.navbar-toggler:focus { box-shadow: 0 0 0 .2rem rgba(96, 165, 250, .3); }

.card { border: 1px solid var(--app-border); border-radius: var(--app-radius); background: var(--app-surface); box-shadow: var(--app-shadow); }
.card-header { border-color: var(--app-border); background: rgba(248, 250, 252, .75); }
.btn { border-radius: 10px; font-weight: 600; }
.btn-primary { border-color: var(--app-primary); background: var(--app-primary); box-shadow: 0 6px 14px rgba(37, 99, 235, .18); }
.btn-primary:hover, .btn-primary:focus { border-color: var(--app-primary-dark); background: var(--app-primary-dark); }
.btn-outline-secondary { border-color: #cbd5e1; color: #475569; }
.btn-outline-secondary:hover { border-color: #94a3b8; background: #f1f5f9; color: #0f172a; }
.form-control, .form-select { border-color: #cbd5e1; border-radius: 10px; color: var(--app-navy); }
.form-control:focus, .form-select:focus { border-color: #60a5fa; box-shadow: 0 0 0 .22rem rgba(37, 99, 235, .11); }
.form-label { color: #334155; font-weight: 600; }
.form-text, .text-muted { color: var(--app-muted) !important; }
.app-alert { border: 0; border-left: 4px solid currentColor; border-radius: 11px; box-shadow: 0 8px 24px rgba(15, 23, 42, .06); }
.table { --bs-table-bg: transparent; color: #334155; }
.table th { padding: .9rem 1rem; border-bottom-color: var(--app-border); color: #64748b; font-size: .73rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; }
.table td { padding: .95rem 1rem; border-bottom-color: #eef2f7; }
.table tbody tr:last-child td { border-bottom: 0; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f8fafc; }
.pricing-table { min-width: 900px; }
.orders-table-card { overflow: hidden; }
.orders-table-viewport { width: 100%; overflow-x: hidden; overflow-y: visible; }
.orders-table { width: 100%; min-width: 0; table-layout: fixed; }
.orders-table th, .orders-table td { padding: .72rem .42rem; white-space: normal; overflow-wrap: anywhere; word-break: break-word; line-height: 1.45; }
.orders-table .col-sequence { width: 3%; }
.orders-table .col-sale-date, .orders-table .col-visit-date { width: 6%; }
.orders-table .col-identity { width: 13%; }
.orders-table .col-tier, .orders-table .col-order-type { width: 7%; }
.orders-table .col-merge { width: 13%; }
.orders-table .col-cost { width: 5%; }
.orders-table .col-sale { width: 6%; }
.orders-table .col-fee { width: 7%; }
.orders-table .col-profit { width: 6%; }
.orders-table .col-creator { width: 5%; }
.orders-table .col-created { width: 8%; }
.orders-table .col-actions { width: 11%; }
.orders-table .cell-actions > .btn, .orders-table .cell-actions > form > .btn { display: block; width: 100%; margin: 0; padding-inline: .3rem; }
.orders-table .cell-actions > form { display: block; margin-top: .4rem; }
.orders-table .sale-edit .btn { padding-inline: .35rem; }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.25rem; margin-bottom: 1.5rem; }
.page-heading h1 { margin: .18rem 0 .4rem; font-size: clamp(1.65rem, 3vw, 2.1rem); font-weight: 750; letter-spacing: -.035em; }
.page-heading p { margin: 0; color: var(--app-muted); }
.page-eyebrow { color: var(--app-primary); font-size: .72rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.page-primary-action { display: inline-flex; align-items: center; gap: .35rem; min-height: 44px; padding-inline: 1.15rem; white-space: nowrap; }
.page-primary-action span { font-size: 1.2rem; font-weight: 400; line-height: 1; }

.dashboard-stats { margin-bottom: 1.5rem; }
.stat { position: relative; min-height: 154px; padding: 1.1rem; overflow: hidden; box-shadow: 0 8px 24px rgba(15, 23, 42, .045); transition: transform .18s ease, box-shadow .18s ease; }
.stat::after { content: ""; position: absolute; right: -26px; bottom: -34px; width: 92px; height: 92px; border-radius: 50%; background: var(--stat-soft, #eff6ff); }
.stat:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(15, 23, 42, .08); }
.stat-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; color: var(--app-muted); font-size: .8rem; font-weight: 650; }
.stat-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; color: var(--stat-color, #2563eb); background: var(--stat-soft, #eff6ff); font-size: .72rem; font-weight: 800; }
.stat strong { position: relative; z-index: 1; display: block; margin-top: .8rem; font-size: clamp(1.25rem, 2vw, 1.58rem); letter-spacing: -.025em; }
.stat > small { position: relative; z-index: 1; display: block; margin-top: .3rem; color: #94a3b8; font-size: .72rem; }
.stat-orders { --stat-color: #2563eb; --stat-soft: #eff6ff; }
.stat-revenue { --stat-color: #0891b2; --stat-soft: #ecfeff; }
.stat-cost { --stat-color: #7c3aed; --stat-soft: #f5f3ff; }
.stat-fee { --stat-color: #e11d48; --stat-soft: #fff1f2; }
.stat-profit { --stat-color: #059669; --stat-soft: #ecfdf5; }
.dashboard-orders { overflow: hidden; }
.dashboard-card-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.15rem; background: #fff; }
.dashboard-card-header h2 { margin: 0; font-size: 1rem; font-weight: 750; }
.dashboard-card-header p { margin: .24rem 0 0; color: var(--app-muted); font-size: .76rem; }
.dashboard-empty { display: flex; flex-direction: column; align-items: center; padding: 2.2rem 1rem; color: var(--app-muted); text-align: center; }
.dashboard-empty > span { display: grid; place-items: center; width: 46px; height: 46px; margin-bottom: .75rem; border-radius: 14px; color: #3b82f6; background: #eff6ff; font-weight: 800; }
.dashboard-empty strong { color: #334155; font-size: .92rem; }
.dashboard-empty small { margin-top: .3rem; }

body.app-login { background: #f3f5f8; }
.app-login .app-main { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; min-height: auto; padding-top: 2rem; padding-bottom: 2rem; }
.app-login .app-alert { width: min(100%, 420px); margin: 0; }
.login-shell { width: min(100%, 420px); margin: 0; border: 1px solid #e2e8f0; border-radius: 16px; background: #fff; box-shadow: 0 16px 40px rgba(15, 23, 42, .08); }
.login-panel { padding: 2.5rem; }
.login-panel-head { margin-bottom: 2rem; text-align: center; }
.login-panel h1 { margin: 0; color: #0f172a; font-size: 1.55rem; font-weight: 700; line-height: 1.35; letter-spacing: -.025em; }
.login-form .form-label { margin-bottom: .5rem; color: #334155; font-size: .88rem; font-weight: 600; }
.login-form .form-control-lg { min-height: 50px; padding: .75rem .9rem; border-color: #cbd5e1; border-radius: 10px; font-size: .92rem; }
.login-form .form-control-lg:focus { border-color: #2563eb; box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .12); }
.login-submit { min-height: 50px; border-radius: 10px; font-size: .92rem; font-weight: 600; }

@media (max-width: 1199.98px) {
  .app-user-area { margin-top: .75rem; padding: .75rem 0 .25rem; border-top: 1px solid rgba(255, 255, 255, .1); border-left: 0; }
  .app-nav-links { margin-top: .8rem; }
  .app-nav-links .nav-link { padding-inline: .8rem; }
  .orders-table .col-order-type, .orders-table .cell-order-type,
  .orders-table .col-cost, .orders-table .cell-cost,
  .orders-table .col-creator, .orders-table .cell-creator { display: none; }
  .orders-table .col-sequence { width: 4%; }
  .orders-table .col-sale-date, .orders-table .col-visit-date { width: 8%; }
  .orders-table .col-identity { width: 16%; }
  .orders-table .col-tier { width: 10%; }
  .orders-table .col-merge { width: 13%; }
  .orders-table .col-sale, .orders-table .col-fee { width: 8%; }
  .orders-table .col-profit { width: 9%; }
  .orders-table .col-created { width: 9%; }
  .orders-table .col-actions { width: 15%; }
}

@media (max-width: 767.98px) {
  .app-main { padding-top: 1.35rem; }
  .page-heading { align-items: center; }
  .page-heading p { font-size: .85rem; }
  .orders-table .col-sequence, .orders-table .cell-sequence, .orders-table .result-sequence,
  .orders-table .col-sale-date, .orders-table .cell-sale-date,
  .orders-table .col-merge, .orders-table .cell-merge,
  .orders-table .col-fee, .orders-table .cell-fee,
  .orders-table .col-profit, .orders-table .cell-profit,
  .orders-table .col-created, .orders-table .cell-created { display: none; }
  .orders-table .col-visit-date { width: 18%; }
  .orders-table .col-identity { width: 28%; }
  .orders-table .col-tier { width: 20%; }
  .orders-table .col-sale { width: 14%; }
  .orders-table .col-actions { width: 20%; }
  .orders-table th, .orders-table td { padding: .65rem .28rem; font-size: .72rem; }
  .orders-table .cell-actions .btn { font-size: .68rem; }
}

@media (max-width: 575.98px) {
  .app-navbar .container-xxl { padding-inline: .85rem; }
  .app-main { padding-inline: .8rem; padding-bottom: 2rem; }
  .app-brand { margin-right: 0; }
  .page-heading { align-items: flex-start; }
  .page-heading p { max-width: 230px; }
  .page-primary-action { min-height: 40px; padding-inline: .85rem; font-size: .82rem; }
  .dashboard-stats { --bs-gutter-x: .7rem; --bs-gutter-y: .7rem; }
  .dashboard-stats > div:last-child { flex: 0 0 100%; max-width: 100%; }
  .stat { min-height: 142px; padding: .9rem; }
  .stat strong { font-size: 1.14rem; }
  .stat-head { align-items: flex-start; font-size: .74rem; }
  .stat-icon { width: 28px; height: 28px; }
  .dashboard-card-header { padding: .9rem; }
  .dashboard-orders .table th:nth-child(2),
  .dashboard-orders .table td:nth-child(2),
  .dashboard-orders .table th:nth-child(5),
  .dashboard-orders .table td:nth-child(5),
  .dashboard-orders .table th:nth-child(6),
  .dashboard-orders .table td:nth-child(6),
  .dashboard-orders .table th:nth-child(7),
  .dashboard-orders .table td:nth-child(7) { display: none; }
  .table { font-size: .78rem; }
  .table th, .table td { padding: .75rem .8rem; }
  .btn { margin-bottom: .15rem; }
  .app-login .app-main { padding: .8rem; }
  .app-footer-content { flex-wrap: wrap; column-gap: .5rem; min-height: 62px; padding-inline: .8rem; text-align: center; }
  .login-panel { padding: 2rem 1.5rem; }
  .login-panel-head { margin-bottom: 1.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
