:root {
  --ink: #15221e;
  --muted: #6c7a74;
  --line: #dfe7e3;
  --paper: #f5f7f3;
  --panel: #ffffff;
  --green: #176b4d;
  --green-2: #25a56f;
  --lime: #d9f26a;
  --danger: #b74444;
  --shadow: 0 18px 50px rgba(23, 50, 40, .08);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  color: var(--ink);
  background:
    radial-gradient(circle at 90% 5%, rgba(217, 242, 106, .18), transparent 23rem),
    var(--paper);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 232px minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 28px 18px;
  display: flex; flex-direction: column; background: #102b22; color: #eef8f3;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 34px; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 18px; letter-spacing: .08em; }
.brand span { font-size: 12px; color: #94b1a6; margin-top: 2px; }
.brand-mark {
  width: 56px; height: 56px; display: grid; place-items: center; border-radius: 18px;
  color: #102b22; background: var(--lime); font-weight: 900; letter-spacing: -.06em; box-shadow: 0 12px 28px rgba(217,242,106,.2);
}
.brand-mark.small { width: 40px; height: 40px; border-radius: 12px; font-size: 14px; }
.sidebar nav { display: grid; gap: 7px; }
.nav-item {
  width: 100%; border: 0; border-radius: 12px; padding: 12px 14px; text-align: left;
  color: #9cb5ab; background: transparent; transition: .2s ease;
}
.nav-item:hover, .nav-item.active { color: white; background: rgba(255,255,255,.1); }
.nav-item.active { box-shadow: inset 3px 0 var(--lime); }
.sidebar-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.1); padding: 18px 8px 0; }
.connection-dot { display: flex; gap: 9px; align-items: center; font-size: 12px; color: #9cb5ab; margin-bottom: 14px; }
.connection-dot i { width: 8px; height: 8px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 5px rgba(217,242,106,.12); }
.ghost-link { border: 0; padding: 0; background: transparent; color: #78978b; font-size: 12px; }
.main { min-width: 0; padding: 34px 42px 60px; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.topbar h1, h2 { margin: 0; letter-spacing: -.035em; }
.topbar h1 { font-size: clamp(28px, 3vw, 42px); }
h2 { font-size: 20px; }
.eyebrow { margin: 0 0 8px; color: var(--green); font-size: 10px; font-weight: 800; letter-spacing: .18em; }
.top-actions { display: flex; align-items: center; gap: 14px; }
.last-sync { color: var(--muted); font-size: 12px; }
.button { border: 0; border-radius: 12px; padding: 11px 17px; font-weight: 700; transition: transform .15s ease, opacity .15s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.button.primary { color: white; background: var(--green); box-shadow: 0 10px 24px rgba(23,107,77,.2); }
.button.secondary { color: var(--green); background: #e8f1ec; }
.button.full { width: 100%; }
.view { display: none; }
.view.active { display: block; animation: reveal .25s ease; }
@keyframes reveal { from { opacity: 0; transform: translateY(4px); } }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.metric-card, .panel { background: var(--panel); border: 1px solid rgba(21,34,30,.06); border-radius: 20px; box-shadow: var(--shadow); }
.metric-card { min-height: 160px; padding: 22px; display: flex; flex-direction: column; }
.metric-card span { color: var(--muted); font-size: 13px; }
.metric-card strong { margin: auto 0 6px; font-size: 36px; letter-spacing: -.06em; }
.metric-card small { color: #94a29d; }
.metric-card.accent { color: white; background: var(--green); }
.metric-card.accent span, .metric-card.accent small { color: #c7e0d6; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 16px; }
.panel { padding: 22px; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.text-button { color: var(--green); border: 0; background: transparent; font-weight: 700; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th { color: #809089; font-size: 11px; font-weight: 700; text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 14px 12px; border-bottom: 1px solid #edf1ef; font-size: 13px; vertical-align: top; }
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: #f7faf8; }
.order-no { color: var(--green); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; }
.goods-cell { max-width: 340px; line-height: 1.45; }
.contact { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.pill { display: inline-flex; border-radius: 999px; padding: 4px 8px; font-size: 11px; font-weight: 700; background: #edf1ef; color: #69756f; white-space: nowrap; }
.pill.paid { color: #116746; background: #dcf4e8; }
.pill.refunded { color: #a45624; background: #fff0e3; }
.sync-panel { text-align: center; background: #eff6f0; }
.sync-panel h2 { text-align: left; }
.sync-orbit { width: 145px; height: 145px; margin: 28px auto 18px; padding: 22px; border: 1px dashed #9fb8ae; border-radius: 50%; animation: orbit 18s linear infinite; }
@keyframes orbit { to { transform: rotate(360deg); } }
.sync-core { height: 100%; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--green); font-weight: 800; animation: orbit 18s linear infinite reverse; }
.sync-core.running { background: var(--green-2); box-shadow: 0 0 0 10px rgba(37,165,111,.12); }
.sync-panel > p:not(.eyebrow) { min-height: 38px; color: var(--muted); font-size: 13px; }
.sync-meta { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid #dbe6df; font-size: 12px; }
.sync-meta span { color: var(--muted); }
.toolbar { align-items: flex-end; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
input, select {
  width: 100%; border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px;
  color: var(--ink); background: white; outline: none; transition: border .15s ease, box-shadow .15s ease;
}
input:focus, select:focus { border-color: #66a68c; box-shadow: 0 0 0 3px rgba(23,107,77,.08); }
.filters input { width: 260px; }
.filters select { width: 140px; }
.empty { display: none; padding: 56px 20px; color: var(--muted); text-align: center; }
.buyer-layout { display: grid; grid-template-columns: minmax(480px, 1fr) minmax(300px, .7fr); gap: 22px; }
#buyers-table tr { cursor: pointer; }
#buyers-table tr.selected { background: #eef6f1; }
.buyer-detail { min-height: 420px; padding: 18px; border-radius: 16px; background: #f4f7f4; }
.empty-detail { min-height: 380px; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.buyer-detail h3 { margin: 0 0 5px; font-size: 17px; }
.timeline { margin-top: 22px; border-left: 1px solid #bfd0c8; padding-left: 18px; }
.timeline-item { position: relative; padding: 0 0 22px; }
.timeline-item::before { content: ""; position: absolute; width: 9px; height: 9px; left: -23px; top: 4px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px #e2eee8; }
.timeline-item strong, .timeline-item span { display: block; }
.timeline-item span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); gap: 16px; }
#settings-form { display: grid; gap: 14px; margin-top: 22px; }
label { display: grid; gap: 7px; color: #485650; font-size: 12px; font-weight: 700; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
hr { width: 100%; border: 0; border-top: 1px solid var(--line); margin: 8px 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.help-panel ol { display: grid; gap: 24px; padding: 12px 0 0 22px; }
.help-panel li { padding-left: 6px; }
.help-panel li::marker { color: var(--green); font-weight: 900; }
.help-panel strong, .help-panel span { display: block; }
.help-panel span { margin-top: 5px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.security-note { margin-top: 28px; padding: 16px; border-radius: 14px; color: #57675f; background: #edf3ef; font-size: 12px; line-height: 1.6; }
.toast { position: fixed; right: 28px; bottom: 28px; z-index: 10; max-width: 380px; padding: 13px 16px; border-radius: 12px; color: white; background: #17382d; box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--danger); }
.login-body { display: grid; place-items: center; min-height: 100vh; background: #102b22; }
.login-body::before { content: ""; position: fixed; width: 520px; height: 520px; border-radius: 50%; left: -180px; top: -220px; background: rgba(217,242,106,.09); }
.login-shell { width: min(440px, calc(100% - 32px)); position: relative; }
.login-card { display: grid; gap: 22px; padding: 38px; border-radius: 26px; background: white; box-shadow: 0 30px 80px rgba(0,0,0,.25); }
.login-card h1 { margin: 0; font-size: 31px; letter-spacing: -.05em; }
.muted { margin: 6px 0 0; color: var(--muted); }
.login-form { display: grid; gap: 14px; }
.alert { padding: 11px 13px; border-radius: 10px; font-size: 13px; }
.alert.danger { color: #8f3030; background: #fdeaea; }
@media (max-width: 1100px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .overview-grid, .settings-grid { grid-template-columns: 1fr; }
  .buyer-layout { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 16px; flex-direction: row; align-items: center; overflow-x: auto; }
  .brand { padding: 0 16px 0 0; }
  .sidebar nav { display: flex; }
  .nav-item { white-space: nowrap; }
  .sidebar-foot { display: none; }
  .main { padding: 24px 16px 48px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .top-actions { width: 100%; justify-content: space-between; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric-card { min-height: 130px; }
  .metric-card strong { font-size: 28px; }
  .panel { padding: 16px; }
  .panel-head.toolbar { align-items: stretch; flex-direction: column; }
  .filters input, .filters select { width: 100%; }
  .filters { display: grid; grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
}
@media (max-width: 460px) {
  .metrics { grid-template-columns: 1fr; }
}

