
:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --border: #e2e8f0;
  --border-soft: #eef2f7;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --accent: #06b6d4;
  --success: #047857;
  --success-soft: #ecfdf5;
  --warning: #b45309;
  --warning-soft: #fffbeb;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 12px 32px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 2px 4px rgba(15, 23, 42, 0.04), 0 24px 60px -20px rgba(15, 23, 42, 0.22);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.65;
  background:
    radial-gradient(1100px 480px at 100% -8%, rgba(37, 99, 235, 0.08), transparent 62%),
    radial-gradient(900px 420px at -10% 22%, rgba(6, 182, 212, 0.06), transparent 60%),
    var(--bg);
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

h1, h2, h3, h4 { line-height: 1.3; margin: 0; }
p { margin: 0; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 22px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; background: var(--primary); color: #fff;
  padding: 8px 14px; z-index: 100;
}
.skip-link:focus { left: 12px; top: 12px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid rgba(226, 232, 240, 0.75);
}
.header-inner { display: flex; align-items: center; gap: 26px; min-height: 68px; }
.brand { display: inline-flex; align-items: center; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-name {
  font-size: 20px; font-weight: 800; letter-spacing: 0.6px; white-space: nowrap;
  background: linear-gradient(100deg, #0b1220 10%, #2563eb 55%, #0e7490 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.site-nav { display: flex; align-items: center; gap: 3px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.site-nav::-webkit-scrollbar { display: none; }
.nav-link {
  padding: 7px 12px; border-radius: 9px; color: #475569; font-size: 13.5px; white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-link:hover { background: #f1f5f9; color: var(--text); }
.nav-link.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 650; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.header-auth { display: flex; gap: 8px; }
.header-user { display: flex; align-items: center; gap: 10px; }
.balance-pill {
  font-size: 12px; color: var(--muted); background: #f8fafc; border: 1px solid var(--border);
  padding: 3px 10px; border-radius: 999px; white-space: nowrap;
}
.menu { position: relative; }
.menu-panel {
  display: none; position: absolute; right: 0; top: calc(100% + 8px); min-width: 168px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 6px; z-index: 50;
}
.menu:hover .menu-panel, .menu:focus-within .menu-panel { display: block; }
.menu-panel a, .menu-panel .link-button {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px;
  color: var(--text); font-size: 13.5px; background: none; border: 0; cursor: pointer; font-family: inherit;
}
.menu-panel a:hover, .menu-panel .link-button:hover { background: #f8fafc; }
.menu-panel form { margin: 0; }

/* ---------- Layout ---------- */
.main { padding-top: 30px; padding-bottom: 60px; min-height: calc(100vh - 200px); }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 24px; margin-bottom: 32px;
  padding: 62px 54px;
  background:
    radial-gradient(1000px 460px at 82% -12%, rgba(6, 182, 212, 0.42), transparent 58%),
    radial-gradient(760px 420px at 2% 112%, rgba(99, 102, 241, 0.34), transparent 58%),
    linear-gradient(135deg, #081226 0%, #0d1f45 52%, #072f45 100%);
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 34px 70px -36px rgba(2, 6, 23, 0.65);
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, 0.16) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(105deg, rgba(0, 0, 0, 0.5), transparent 62%);
  -webkit-mask-image: linear-gradient(105deg, rgba(0, 0, 0, 0.5), transparent 62%);
}
.hero > * { position: relative; z-index: 1; }
.hero h1 {
  font-size: clamp(30px, 4.2vw, 46px); letter-spacing: -1px; max-width: 680px;
  color: #f8fafc; line-height: 1.16;
}
.hero p { color: #b8c6e2; margin-top: 16px; font-size: 16px; max-width: 580px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero-actions .btn-secondary {
  background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.26); color: #f1f5f9;
  backdrop-filter: blur(6px);
}
.hero-actions .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.16); color: #fff; border-color: rgba(255, 255, 255, 0.4);
}
.hero-tags { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 34px; }
.hero-tag {
  font-size: 12.5px; color: #dbeafe; background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14); padding: 5px 11px; border-radius: 999px;
  backdrop-filter: blur(4px);
}

/* ---------- Sections & cards ---------- */
.section { margin: 38px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-head h2 { font-size: 22px; position: relative; padding-bottom: 9px; }
.section-head h2::after {
  content: ""; position: absolute; left: 1px; bottom: 0; width: 32px; height: 3px; border-radius: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}
.section-head p { color: var(--muted); font-size: 13.5px; margin-top: 4px; }

.grid { display: grid; gap: 18px; }
.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)); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow);
}
.card-flat { box-shadow: none; }
.card h3 { font-size: 16px; margin-bottom: 6px; }
.card-sub { color: var(--muted); font-size: 13px; }
.card-actions { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 10px; }

.product-card { display: flex; flex-direction: column; gap: 12px; transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease; }
.product-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: #cbd5e1; }
.product-card .price {
  font-size: 27px; font-weight: 800; letter-spacing: -0.8px; color: var(--text);
}
.product-card .price small { font-size: 13px; color: var(--muted); font-weight: 400; letter-spacing: 0; }
.feature-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 7px; }
.feature-list li { color: #334155; font-size: 13.5px; padding-left: 21px; position: relative; }
.feature-list li::before {
  content: "✓"; position: absolute; left: 0; top: 0; color: var(--primary); font-weight: 800; font-size: 12px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 17px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: 13.5px; font-weight: 650; font-family: inherit; cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease,
    box-shadow 0.15s ease, transform 0.1s ease;
  text-align: center; line-height: 1.4;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff;
  box-shadow: 0 8px 18px -8px rgba(37, 99, 235, 0.65);
}
.btn-primary:hover { background: linear-gradient(135deg, #1d4ed8, #1e40af); color: #fff; }
.btn-secondary { background: #fff; border-color: #dbe3ef; color: var(--text); }
.btn-secondary:hover { border-color: #c3cede; background: #f8fafc; color: var(--text); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: #f1f5f9; color: var(--text); }
.btn-danger { background: #dc2626; color: #fff; box-shadow: 0 8px 18px -10px rgba(220, 38, 38, 0.6); }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.inline { display: inline; margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- Alerts & badges ---------- */
.alert {
  border-radius: 12px; padding: 12px 16px; font-size: 13.5px; margin-bottom: 18px;
  border: 1px solid transparent;
}
.alert-success { background: var(--success-soft); border-color: #a7f3d0; color: #065f46; }
.alert-error { background: var(--danger-soft); border-color: #fecaca; color: #991b1b; }
.alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

.badge {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 650; white-space: nowrap; letter-spacing: 0.1px;
}
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--primary-soft); color: var(--primary-dark); }
.badge-muted { background: #f1f5f9; color: var(--muted); }

/* ---------- Page header ---------- */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 24px; flex-wrap: wrap; }
.page-header h1 { font-size: 26px; letter-spacing: -0.4px; }
.page-subtitle { color: var(--muted); font-size: 13.5px; margin-top: 6px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 26px; }
.stat {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 19px 21px; box-shadow: var(--shadow);
}
.stat::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent)); opacity: 0.75;
}
.stat-label { color: var(--muted); font-size: 12.5px; }
.stat-value { font-size: 26px; font-weight: 800; letter-spacing: -0.6px; margin-top: 6px; }
.stat-note { color: var(--muted-2); font-size: 12px; margin-top: 4px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; min-width: 100%; }
.table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--muted); font-weight: 650; padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: #f8fafc; white-space: nowrap;
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border-soft); font-size: 13.5px; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: #fbfcfe; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.empty-cell { text-align: center; color: var(--muted); padding: 36px 16px !important; }
.table-desc { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.mono { font-family: var(--mono); font-size: 12.5px; color: #334155; }
.money { font-variant-numeric: tabular-nums; font-weight: 650; }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 650; color: #334155; }
.field .hint { font-size: 12px; color: var(--muted); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="tel"], input[type="date"], select, textarea {
  width: 100%; padding: 9px 12px; font-size: 14px; font-family: inherit; color: var(--text);
  background: #fff; border: 1px solid #d5deea; border-radius: var(--radius-sm); outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}
input::placeholder, textarea::placeholder { color: #94a3b8; }
textarea { resize: vertical; min-height: 96px; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #64748b 50%), linear-gradient(135deg, #64748b 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: #334155; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--primary); }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.inline-fields { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-fields input, .inline-fields select { width: auto; }

/* ---------- Auth ---------- */
.auth-wrap { display: flex; justify-content: center; padding: 34px 0 10px; }
.auth-card {
  position: relative; overflow: hidden;
  width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 22px; padding: 34px; box-shadow: var(--shadow-lg);
}
.auth-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}
.auth-card h1 { font-size: 25px; margin-bottom: 6px; letter-spacing: -0.4px; }
.auth-sub { color: var(--muted); font-size: 13.5px; margin-bottom: 24px; }
.auth-foot { text-align: center; color: var(--muted); font-size: 13px; margin-top: 20px; }
.auth-foot a { font-weight: 650; }

/* ---------- Detail layouts ---------- */
.layout-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.layout-2-even { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.kv { width: 100%; border-collapse: collapse; }
.kv th, .kv td { text-align: left; padding: 9px 0; font-size: 13.5px; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
.kv th { color: var(--muted); font-weight: 500; width: 118px; }
.kv tr:last-child th, .kv tr:last-child td { border-bottom: 0; }

.card-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.card-title h2, .card-title h3 { font-size: 16px; }

.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.detail-head h1 { font-size: 26px; letter-spacing: -0.3px; }
.detail-meta { color: var(--muted); font-size: 13px; margin-top: 6px; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab { padding: 9px 14px; border-bottom: 2px solid transparent; color: var(--muted); font-size: 13.5px; white-space: nowrap; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 650; }

/* ---------- Timeline (tickets) ---------- */
.timeline { display: flex; flex-direction: column; gap: 14px; }
.reply { border: 1px solid var(--border); border-radius: 13px; padding: 16px; background: #fff; }
.reply-staff { border-color: #c7d2fe; background: #f8faff; }
.reply-internal { border-color: #fde68a; background: #fffdf5; }
.reply-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.reply-author { font-weight: 650; font-size: 13px; }
.reply-time { color: var(--muted-2); font-size: 12px; }
.reply-body { white-space: pre-wrap; word-break: break-word; font-size: 13.5px; color: #1f2937; }

/* ---------- Charts ---------- */
.bars { display: flex; align-items: flex-end; gap: 14px; height: 170px; padding-top: 8px; }
.bar-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bar { width: 100%; max-width: 46px; border-radius: 8px 8px 4px 4px; background: linear-gradient(180deg, #60a5fa, #2563eb); min-height: 4px; }
.bar-label { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.bar-value { color: #334155; font-size: 11px; }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.page-link {
  display: inline-flex; align-items: center; justify-content: center; min-width: 33px; height: 33px;
  padding: 0 9px; border-radius: 9px; border: 1px solid var(--border); color: var(--muted);
  font-size: 13px; background: #fff;
}
.page-link:hover { border-color: #c3cede; color: var(--text); }
.page-link.current { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 650; }
.page-link.disabled { opacity: 0.45; pointer-events: none; }
.page-ellipsis { color: var(--muted-2); padding: 0 2px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: #fff; }
.footer-inner { display: flex; justify-content: space-between; gap: 24px; padding-top: 28px; padding-bottom: 28px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.footer-inner strong { color: var(--text); font-size: 14px; font-weight: 750; }
.footer-inner p { margin-top: 4px; }
.footer-meta { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }

/* ---------- Misc ---------- */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mr-2 { margin-right: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.w-full { width: 100%; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.nowrap { white-space: nowrap; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
.code { background: #0b1220; color: #e2e8f0; padding: 14px 16px; border-radius: 12px; font-family: var(--mono); font-size: 12.5px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .hero, .stat, .card, .table-wrap, .auth-card { animation: rise 0.42s cubic-bezier(0.2, 0.75, 0.25, 1) both; }
}

@media (max-width: 980px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .layout-2, .layout-2-even { grid-template-columns: minmax(0, 1fr); }
  .hero { padding: 44px 30px; }
}

@media (max-width: 720px) {
  .header-inner { flex-wrap: wrap; gap: 10px 16px; padding-top: 10px; padding-bottom: 10px; }
  .site-nav { order: 3; width: 100%; flex: none; }
  .header-actions { margin-left: auto; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .form-row { grid-template-columns: minmax(0, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main { padding-top: 20px; }
  .balance-pill { display: none; }
  .page-header { align-items: flex-start; }
  .footer-inner { flex-direction: column; }
  .table th, .table td { padding-left: 10px; padding-right: 10px; }
}
