/* Native, dependency-free UI for KG agent H5 and the independent admin Web. */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-soft: #fffaf1;
  --text: #20242c;
  --text-soft: #68707d;
  --line: #e8e9ed;
  --primary: #e99016;
  --primary-dark: #b96308;
  --primary-soft: #fff0d7;
  --success: #16835b;
  --success-soft: #e9f7f1;
  --danger: #c8463c;
  --danger-soft: #fff0ee;
  --info: #3572b8;
  --info-soft: #edf5ff;
  --shadow: 0 8px 28px rgba(38, 32, 23, 0.07);
  --radius: 18px;
  --radius-small: 12px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); background: var(--bg); }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 26px; line-height: 1.2; letter-spacing: -0.02em; }
h2 { margin-bottom: 0; font-size: 17px; line-height: 1.35; }
h3 { font-size: 16px; }
p { line-height: 1.65; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid rgba(53, 114, 184, 0.45); outline-offset: 3px; }
.skip-link { position: fixed; z-index: 1000; top: -80px; left: 12px; padding: 10px 16px; color: #fff; background: #222; border-radius: 8px; }
.skip-link:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.connection-banner { position: relative; z-index: 80; width: 100%; padding: 9px 16px; text-align: center; font-size: 12px; font-weight: 650; line-height: 1.45; }
.connection-banner { color: #76500d; background: #fff0c9; border-bottom: 1px solid rgba(137, 90, 0, 0.12); }
.connection-banner[data-state="success"] { color: #126043; background: #e8f6ef; }
.connection-banner[data-state="error"] { color: #943c34; background: #ffefed; }
.noscript-notice { padding: 16px; color: #8d332d; background: var(--danger-soft); text-align: center; }

.agent-body { max-width: 560px; margin: 0 auto; background: var(--bg); box-shadow: 0 0 50px rgba(30, 35, 40, 0.05); }
.agent-shell { min-height: 100vh; }
.agent-main { min-height: calc(100vh - 210px); padding: 18px 16px calc(96px + var(--safe-bottom)); outline: none; }
.app-page { animation: page-in 180ms ease-out; }
@keyframes page-in { from { opacity: 0.4; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }

.panel { padding: 18px; background: var(--surface); border: 1px solid rgba(30, 35, 40, 0.035); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel + .panel { margin-top: 14px; }
.eyebrow { margin-bottom: 7px; color: var(--primary-dark); font-size: 11px; font-weight: 750; letter-spacing: 0.12em; text-transform: uppercase; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-heading .badge { flex: none; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 0 12px; }
.section-heading h2 { margin-bottom: 4px; }
.section-heading p { margin: 0; color: var(--text-soft); font-size: 12px; }
.section-heading > a { flex: none; font-size: 13px; font-weight: 650; }
.section-heading.compact { margin: 0 0 14px; }
.section-heading.compact > span { color: var(--text-soft); font-size: 11px; }

.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border: 1px solid transparent; border-radius: 12px; font-size: 14px; font-weight: 650; line-height: 1.25; text-align: center; transition: transform 100ms ease, background 100ms ease; }
.button:active:not(:disabled) { transform: scale(0.98); }
.button-primary { color: #fff; background: linear-gradient(135deg, #f4ac32, #e78412); box-shadow: 0 5px 14px rgba(221, 132, 15, 0.2); }
.button-secondary { color: #8f540d; background: var(--primary-soft); border-color: #f6d49f; }
.button-ghost { color: var(--text-soft); background: transparent; border-color: var(--line); box-shadow: none; }
.button-danger-ghost { color: var(--danger); background: #fff; border-color: #efcbc7; }
.button-small { min-height: 36px; padding: 7px 12px; border-radius: 10px; font-size: 12px; }
.button-block { width: 100%; }
.icon-button { position: relative; display: inline-flex; width: 44px; min-width: 44px; height: 44px; align-items: center; justify-content: center; padding: 0; color: inherit; background: transparent; border: 0; border-radius: 50%; font-size: 18px; }
.icon-button:hover { background: rgba(0, 0, 0, 0.05); }

.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 650; }
.field input, .field textarea, .field select,
.search-form input, .chat-composer textarea, .admin-filter input, .admin-filter select {
  width: 100%; min-height: 46px; padding: 11px 13px; color: var(--text); background: #fff; border: 1px solid #dcdfe4; border-radius: 12px; outline: none;
}
.field textarea, .chat-composer textarea { resize: vertical; }
.field input:focus, .field textarea:focus, .search-form input:focus, .chat-composer textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(233, 144, 22, 0.12); }
.field-help { margin: 7px 0 0; color: var(--text-soft); font-size: 11px; line-height: 1.55; }
.form-error { margin: 0 0 14px; padding: 10px 12px; color: #9a352e; background: var(--danger-soft); border-radius: 10px; font-size: 13px; line-height: 1.5; }

.login-view { min-height: 100vh; padding: 28px 20px calc(30px + var(--safe-bottom)); background: radial-gradient(circle at 100% 0, #ffe5ad 0, transparent 40%), linear-gradient(180deg, #fffaf1 0, var(--bg) 48%); }
.login-brand { display: flex; align-items: center; justify-content: space-between; }
.brand-mark { display: inline-flex; width: 48px; height: 48px; align-items: center; justify-content: center; color: #fff; background: linear-gradient(145deg, #f5b640, #de7c0c); border-radius: 15px; font-size: 17px; font-weight: 850; letter-spacing: -0.03em; box-shadow: 0 8px 20px rgba(199, 115, 11, 0.2); }
.version-pill { padding: 5px 10px; color: #885515; background: rgba(255, 255, 255, 0.8); border: 1px solid #f0ddbc; border-radius: 20px; font-size: 11px; }
.login-hero { margin: 54px 0 28px; }
.login-hero h1 { margin-bottom: 14px; font-size: 34px; }
.login-hero > p:last-child { margin-bottom: 0; color: var(--text-soft); font-size: 14px; }
.login-panel { padding: 22px; }
.login-panel .button + .button { margin-top: 10px; }
.login-boundary { margin: 16px 0 0; color: var(--text-soft); font-size: 11px; text-align: center; }
.login-footer { margin: 24px 8px 0; color: var(--text-soft); font-size: 11px; text-align: center; }

.agent-header { position: relative; z-index: 20; color: #fff; background: linear-gradient(135deg, #eaa02b, #d97c12); }
.agent-header-main { display: flex; min-height: 72px; align-items: center; gap: 8px; padding: 12px 14px; }
.agent-header-back { margin-left: -8px; }
.header-back { color: #fff; font-size: 34px; }
.agent-identity { display: flex; min-width: 0; flex: 1; align-items: center; gap: 10px; }
.agent-avatar { display: inline-flex; width: 40px; height: 40px; flex: none; align-items: center; justify-content: center; color: #a25e0a; background: #fff3d9; border: 2px solid rgba(255, 255, 255, 0.45); border-radius: 50%; font-weight: 800; }
.agent-identity strong { display: block; overflow: hidden; margin-bottom: 3px; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.agent-identity div > span { display: block; color: #fff2d7; font-size: 11px; }
.agent-header-actions { display: flex; align-items: center; gap: 2px; }
.online-status { color: #fff4de; font-size: 11px; white-space: nowrap; }
.agent-header .icon-button { color: #fff; }
.agent-header .icon-button:hover { background: rgba(255, 255, 255, 0.14); }
.unread-dot { position: absolute; top: 2px; right: 0; min-width: 17px; height: 17px; padding: 0 4px; color: #fff; background: #c83932; border: 2px solid #e49220; border-radius: 10px; font-size: 9px; line-height: 13px; }
.header-notice { display: flex; justify-content: space-between; gap: 8px; padding: 7px 16px; color: #ffe9c0; background: rgba(110, 55, 0, 0.12); font-size: 10px; }

.segmented-control { display: grid; grid-template-columns: repeat(2, 1fr); padding: 4px; background: #e8e9ec; border-radius: 14px; }
.segmented-control button { min-height: 42px; padding: 8px; color: var(--text-soft); background: transparent; border: 0; border-radius: 11px; font-size: 14px; font-weight: 650; }
.segmented-control button.active { color: #8f5205; background: #fff; box-shadow: 0 3px 10px rgba(40, 35, 25, 0.08); }
.direction-switch { margin-bottom: 16px; }

.balance-card { position: relative; overflow: hidden; padding: 22px 20px 17px; color: #fff; background: linear-gradient(135deg, #353b48 0%, #222832 65%, #1c2129 100%); border-radius: 22px; box-shadow: 0 12px 28px rgba(28, 32, 39, 0.18); }
.balance-card::after { position: absolute; top: -65px; right: -50px; width: 180px; height: 180px; background: radial-gradient(circle, rgba(242, 171, 57, 0.23), transparent 68%); content: ""; pointer-events: none; }
.balance-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #d9dde5; font-size: 12px; }
.balance-rate { color: #eabf7c; font-size: 10px; }
.balance-total { display: block; margin: 12px 0 3px; font-size: clamp(30px, 8vw, 39px); line-height: 1.15; letter-spacing: 0.01em; overflow-wrap: anywhere; }
.balance-equivalent { color: #d3d7df; font-size: 12px; }
.balance-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 22px; padding-top: 17px; border-top: 1px solid rgba(255, 255, 255, 0.11); }
.balance-grid > div + div { padding-left: 16px; border-left: 1px solid rgba(255, 255, 255, 0.11); }
.balance-grid span, .balance-grid small { display: block; color: #bfc5d0; font-size: 10px; }
.balance-grid strong { display: block; margin: 7px 0 4px; color: #ffcc78; font-size: 19px; overflow-wrap: anywhere; }
.balance-explanation { margin: 15px 0 0; color: #aeb5c0; font-size: 10px; line-height: 1.55; }

.wallet-card, .reconciliation-card { margin-bottom: 14px; }
.wallet-card .section-heading, .reconciliation-card .section-heading { align-items: flex-start; }
.wallet-card .section-heading .eyebrow, .reconciliation-card .section-heading .eyebrow { margin-bottom: 4px; }
.wallet-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.wallet-grid > div { min-width: 0; padding: 15px; background: var(--info-soft); border: 1px solid #dbe8f7; border-radius: var(--radius-small); }
.wallet-grid span, .wallet-grid strong, .reconciliation-grid span, .reconciliation-grid strong { display: block; }
.wallet-grid span, .reconciliation-grid span { color: var(--text-soft); font-size: 11px; }
.wallet-grid strong { margin-top: 7px; color: var(--info); font-size: 25px; overflow-wrap: anywhere; }
.wallet-meta { margin: 14px 0 0; }
.wallet-meta > div { display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 11px; }
.wallet-meta > div:last-child { border-bottom: 0; }
.wallet-meta dt { color: var(--text-soft); }
.wallet-meta dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.data-note { margin: 13px 0 0; color: var(--text-soft); font-size: 11px; line-height: 1.65; }
.reconciliation-grid { display: grid; gap: 10px; }
.reconciliation-grid > div { min-width: 0; padding: 12px 14px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: var(--radius-small); }
.reconciliation-grid strong { margin-top: 6px; font-size: 19px; overflow-wrap: anywhere; }
.reconciliation-grid > div:last-child strong { color: var(--primary-dark); }

.accepting-panel { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; box-shadow: none; }
.accepting-panel strong { font-size: 14px; }
.accepting-panel p { margin: 6px 0 0; color: var(--text-soft); font-size: 11px; line-height: 1.5; }
.switch { position: relative; display: flex; width: 84px; min-width: 84px; height: 40px; align-items: center; justify-content: flex-end; padding: 4px 9px 4px 30px; color: #656c76; background: #e5e7ea; border: 0; border-radius: 22px; transition: background 160ms ease; }
.switch-thumb { position: absolute; top: 4px; left: 4px; width: 32px; height: 32px; background: #fff; border-radius: 50%; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15); transition: transform 160ms ease; }
.switch.is-on { justify-content: flex-start; padding: 4px 30px 4px 9px; color: #fff; background: var(--success); }
.switch.is-on .switch-thumb { transform: translateX(44px); }
.switch-text { font-size: 11px; font-weight: 700; }

.notice { margin: 12px 0; padding: 12px 14px; border-radius: 12px; font-size: 12px; line-height: 1.6; }
.notice-info { color: #315f91; background: var(--info-soft); border: 1px solid #d7e8fb; }
.notice-warning { color: #85520c; background: #fff4dd; border: 1px solid #f2ddb7; }
.notice-danger { color: #973c34; background: var(--danger-soft); border: 1px solid #f0d0cc; }
.notice-success { color: #176c4e; background: var(--success-soft); border: 1px solid #cdeadd; }

.filter-chips { display: flex; gap: 8px; margin: 14px -16px 14px; padding: 0 16px 3px; overflow-x: auto; scrollbar-width: none; }
.filter-chips::-webkit-scrollbar { display: none; }
.filter-chips button { min-height: 36px; flex: none; padding: 7px 14px; color: var(--text-soft); background: #fff; border: 1px solid var(--line); border-radius: 20px; font-size: 12px; }
.filter-chips button.active { color: #8e5105; background: var(--primary-soft); border-color: #eec27e; font-weight: 700; }
.search-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-bottom: 12px; }
.search-form .button { min-height: 46px; }
.list-summary { color: var(--text-soft); font-size: 11px; }

.order-list { display: grid; gap: 12px; }
.order-card { padding: 16px; background: #fff; border: 1px solid rgba(30, 35, 40, 0.04); border-radius: var(--radius); box-shadow: 0 5px 18px rgba(35, 39, 45, 0.05); }
.order-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.order-card-head > div { min-width: 0; }
.order-kind { display: inline-block; margin-right: 8px; padding: 3px 6px; color: #95580c; background: var(--primary-soft); border-radius: 5px; font-size: 10px; font-weight: 750; }
.order-player { font-size: 13px; }
.badge { display: inline-flex; min-height: 23px; align-items: center; justify-content: center; padding: 3px 8px; border-radius: 7px; font-size: 10px; font-weight: 700; line-height: 1.3; white-space: normal; text-align: center; }
.badge-warning { color: #8c560d; background: #fff0d3; }
.badge-info { color: #2d639e; background: #eaf3fd; }
.badge-success { color: #147451; background: #e5f5ee; }
.badge-danger { color: #a03c34; background: #ffebe9; }
.badge-muted { color: #646b75; background: #edeef0; }
.order-card-amount { display: flex; align-items: baseline; gap: 5px; margin: 15px 0; }
.order-card-amount strong { font-size: 25px; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.order-card-amount > span { color: var(--text-soft); font-size: 11px; }
.order-card-amount b { margin-left: auto; color: var(--primary-dark); font-size: 15px; }
.order-card dl { margin: 0; padding: 11px 0; border-top: 1px solid #f0f0f2; border-bottom: 1px solid #f0f0f2; }
.order-card dl > div { display: flex; justify-content: space-between; gap: 14px; margin: 4px 0; font-size: 10px; }
.order-card dt { flex: none; color: var(--text-soft); }
.order-card dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.order-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 12px; }
.order-hint { color: var(--text-soft); font-size: 10px; line-height: 1.45; }
.order-link { flex: none; }

.bottom-nav { position: fixed; z-index: 40; right: 0; bottom: 0; left: 0; display: grid; max-width: 560px; grid-template-columns: repeat(4, 1fr); margin: 0 auto; padding: 7px 8px calc(7px + var(--safe-bottom)); background: rgba(255, 255, 255, 0.97); border-top: 1px solid var(--line); box-shadow: 0 -6px 18px rgba(35, 39, 45, 0.04); backdrop-filter: blur(14px); }
.bottom-nav a { position: relative; display: flex; min-height: 52px; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: #8a9099; border-radius: 10px; }
.bottom-nav a > span { display: inline-flex; width: 25px; height: 25px; align-items: center; justify-content: center; border: 1px solid currentColor; border-radius: 8px; font-size: 11px; }
.bottom-nav a b { font-size: 10px; font-weight: 600; }
.bottom-nav a.active { color: var(--primary-dark); }
.bottom-nav a.active > span { background: var(--primary-soft); border-color: #edb45b; }
.bottom-nav i { position: absolute; top: 0; left: calc(50% + 8px); min-width: 16px; padding: 1px 4px; color: #fff; background: var(--danger); border-radius: 8px; font-size: 9px; font-style: normal; }

.empty-state { padding: 34px 18px; color: var(--text-soft); background: rgba(255, 255, 255, 0.65); border: 1px dashed #d8dbe0; border-radius: var(--radius); text-align: center; }
.empty-state-icon { display: inline-flex; width: 42px; height: 42px; align-items: center; justify-content: center; margin-bottom: 12px; color: #aa7a37; background: var(--primary-soft); border-radius: 50%; font-size: 24px; line-height: 1; }
.empty-state h3 { margin-bottom: 7px; color: var(--text); font-size: 15px; }
.empty-state p { margin-bottom: 14px; font-size: 12px; }

.notification-list { display: grid; gap: 12px; margin-top: 14px; }
.notification-item { padding: 16px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }
.notification-head, .notification-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.notification-head strong { font-size: 14px; }
.notification-item > p { margin: 11px 0; color: var(--text-soft); font-size: 12px; }
.notification-foot time { color: var(--text-soft); font-size: 10px; }

.profile-card { padding: 20px; color: #fff; background: linear-gradient(135deg, #333b48, #222832); border-radius: 22px; }
.profile-main { display: flex; align-items: center; gap: 12px; }
.profile-avatar { display: inline-flex; width: 54px; height: 54px; flex: none; align-items: center; justify-content: center; color: #9c5b09; background: #ffe2ad; border-radius: 17px; font-size: 22px; font-weight: 800; }
.profile-main > div { min-width: 0; flex: 1; }
.profile-main h1 { font-size: 20px; }
.profile-main p { margin: 5px 0 0; color: #c5cbd5; font-size: 11px; }
.profile-stats { display: grid; grid-template-columns: 0.8fr 0.8fr 1.4fr; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, 0.11); }
.profile-stats div { min-width: 0; }
.profile-stats strong, .profile-stats span { display: block; }
.profile-stats strong { margin-bottom: 5px; color: #ffd18b; font-size: 18px; overflow-wrap: anywhere; }
.profile-stats span { color: #b8c0cb; font-size: 9px; }
.profile-assets { margin-top: 14px; box-shadow: none; }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px 12px; }
.metric-grid div { min-width: 0; }
.metric-grid span, .metric-grid strong { display: block; }
.metric-grid div > span { margin-bottom: 5px; color: var(--text-soft); font-size: 10px; }
.metric-grid strong { font-size: 15px; overflow-wrap: anywhere; }
.profile-assets > p { margin: 16px 0 0; padding-top: 12px; color: var(--text-soft); border-top: 1px solid var(--line); font-size: 10px; }
.profile-menu { margin: 16px 0; }
.menu-unavailable { display: flex; min-height: 52px; align-items: center; justify-content: space-between; gap: 16px; margin: 0 16px; padding: 11px 0; color: var(--text-soft); border-bottom: 1px solid #f0f0f2; font-size: 13px; }
.menu-unavailable:last-child { border-bottom: 0; }
.menu-unavailable small { max-width: 65%; font-size: 10px; line-height: 1.5; text-align: right; }
.capability-section { box-shadow: none; opacity: 0.86; }
.menu-section { overflow: hidden; margin-bottom: 14px; background: #fff; border-radius: var(--radius); box-shadow: 0 4px 16px rgba(35, 39, 45, 0.04); }
.menu-section h2 { margin: 0; padding: 14px 16px 8px; color: var(--text-soft); font-size: 11px; font-weight: 650; }
.menu-section a { display: flex; min-height: 52px; align-items: center; justify-content: space-between; gap: 12px; margin: 0 16px; color: var(--text); border-bottom: 1px solid #f0f0f2; font-size: 13px; }
.menu-section a:last-child { border-bottom: 0; }
.menu-section a span { padding: 11px 0; }
.menu-section a small { display: block; margin-top: 3px; color: var(--text-soft); font-size: 10px; }
.menu-section a b { color: #b1b5bc; font-size: 23px; font-weight: 400; }
.profile-version { margin: 18px 0 0; color: var(--text-soft); font-size: 10px; text-align: center; }

.order-amount-panel { text-align: center; }
.order-amount-panel > span { color: var(--text-soft); font-size: 11px; }
.order-amount-panel > strong { display: block; margin: 8px 0; font-size: 32px; overflow-wrap: anywhere; }
.order-amount-panel p { margin: 0; color: var(--text-soft); font-size: 11px; }
.detail-list { margin: 0; }
.detail-list > div { display: grid; grid-template-columns: minmax(90px, 0.8fr) minmax(0, 1.4fr); gap: 12px; padding: 10px 0; border-bottom: 1px solid #f0f0f2; font-size: 12px; }
.detail-list > div:last-child { padding-bottom: 0; border-bottom: 0; }
.detail-list > div:first-child { padding-top: 0; }
.detail-list dt { color: var(--text-soft); }
.detail-list dd { min-width: 0; margin: 0; text-align: right; overflow-wrap: anywhere; }
.copy-button { min-height: 28px; margin-left: 6px; padding: 3px 6px; color: var(--primary-dark); background: var(--primary-soft); border: 0; border-radius: 6px; font-size: 9px; }
.freeze-panel { border-top: 3px solid #edae4b; }
.timeline { margin: 0; padding: 0 0 0 18px; }
.timeline li { position: relative; padding: 0 0 17px 8px; color: var(--text-soft); border-left: 1px solid #e2e4e8; }
.timeline li:last-child { padding-bottom: 0; border-left-color: transparent; }
.timeline li::before { position: absolute; top: 3px; left: -5px; width: 9px; height: 9px; background: #edae4b; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px #edae4b; content: ""; }
.timeline strong, .timeline time { display: block; }
.timeline strong { margin-bottom: 4px; color: var(--text); font-size: 12px; }
.timeline time { font-size: 10px; }
.action-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.action-panel .button-primary, .action-panel .button-danger-ghost:last-of-type { grid-column: 1 / -1; }
.safe-action-note { margin: 14px 4px; color: var(--text-soft); font-size: 10px; line-height: 1.6; text-align: center; }

.resource-intro h2 { margin-bottom: 10px; }
.resource-intro p { margin: 0; color: var(--text-soft); font-size: 13px; }
.resource-content { margin: 14px 0; }
.record-list { display: grid; gap: 10px; }
.record-card h3 { margin-bottom: 8px; }
.record-card p { margin-bottom: 8px; color: var(--text-soft); font-size: 12px; }
.record-card time { color: var(--text-soft); font-size: 10px; }
.credit-request-panel > h2 { margin-bottom: 10px; }
.credit-request-panel > p:not(.data-note) { color: var(--text-soft); font-size: 13px; }
.credit-request-panel .data-note { margin-top: 14px; }
.credit-history .section-heading { margin-top: 22px; }
.credit-request-record { box-shadow: none; }
.credit-request-record h3 { margin: 0; }
.credit-request-record p { overflow-wrap: anywhere; }
#credit-request-description { margin: 16px 0; color: var(--text-soft); font-size: 12px; line-height: 1.65; }

.chat-messages { display: grid; min-height: 280px; align-content: start; gap: 12px; margin: 14px 0; }
.chat-message { max-width: 88%; padding: 12px 14px; background: #fff; border-radius: 4px 15px 15px 15px; box-shadow: var(--shadow); }
.chat-message strong { font-size: 11px; }
.chat-message p { margin: 7px 0; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-message time { color: var(--text-soft); font-size: 9px; }
.chat-composer { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px; align-items: end; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.chat-composer textarea { min-height: 44px; max-height: 140px; padding: 10px; border: 0; resize: none; }
.chat-composer textarea:focus { box-shadow: none; }
.chat-composer .button { min-height: 42px; padding: 9px 13px; }
.chat-composer .icon-button { color: var(--text-soft); }

.message-support-entry { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 14px; margin: 14px 0; padding: 16px 18px; color: var(--text); background: #fff; border: 1px solid var(--line); border-radius: var(--radius-small); box-shadow: var(--shadow); }
.message-support-entry > span { min-width: 0; }
.message-support-entry strong, .message-support-entry small { display: block; overflow-wrap: anywhere; }
.message-support-entry small { margin-top: 5px; color: var(--text-soft); font-size: 11px; }
.message-support-entry > b { flex: none; font-size: 24px; }
.support-page { width: 100%; max-width: 980px; min-width: 0; margin: 0 auto; }
.support-boundary { margin-top: 0; }
.support-history-status { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 12px; }
.support-history-status > span { min-width: 0; overflow-wrap: anywhere; }
.support-history-status .button { flex: none; }
.support-messages { display: flex; width: 100%; min-width: 0; height: min(58vh, 620px); min-height: 280px; flex-direction: column; gap: 12px; margin: 14px 0; padding: 16px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; background: #f4f6f8; border: 1px solid var(--line); border-radius: 12px; scrollbar-gutter: stable; }
.support-message { width: fit-content; max-width: min(82%, 680px); min-width: 0; padding: 11px 13px; overflow-wrap: anywhere; background: #fff; border: 1px solid var(--line); border-radius: 4px 14px 14px 14px; }
.support-message--agent { align-self: flex-end; background: var(--primary-soft); border-color: #f0d4a7; border-radius: 14px 4px 14px 14px; }
.support-message--admin { align-self: flex-start; }
.support-message--pending { border-style: dashed; box-shadow: none; }
.support-message-head { display: flex; min-width: 0; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.support-message-head strong { font-size: 11px; }
.support-message time { color: var(--text-soft); font-size: 10px; }
.support-message-body { margin: 7px 0 0; font-size: 13px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.support-message-state { margin: 8px 0 0; color: var(--text-soft); font-size: 11px; line-height: 1.5; }
.support-message--failed .support-message-state { color: var(--danger); }
.support-message--uncertain .support-message-state { color: #85520c; }
.support-message-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.support-message-actions .button { min-height: 34px; padding: 6px 10px; }
.support-composer { display: grid; min-width: 0; gap: 9px; padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.support-composer > label { font-size: 13px; font-weight: 650; }
.support-composer textarea { width: 100%; min-width: 0; min-height: 82px; max-height: 180px; padding: 11px 13px; color: var(--text); background: #fff; border: 1px solid #d0d5dd; border-radius: 9px; outline: none; resize: vertical; }
.support-composer textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(233, 144, 22, 0.12); }
.support-composer-meta { display: flex; min-width: 0; flex-wrap: wrap; justify-content: space-between; gap: 5px 12px; color: var(--text-soft); font-size: 10px; line-height: 1.5; }
.support-composer .form-error { margin: 0; }
.support-composer > .button { min-width: 120px; justify-self: end; }
.support-page > .safe-action-note { margin: 12px 4px 0; line-height: 1.6; }
@media (min-width: 1024px) {
  .support-messages { height: min(62vh, 640px); }
  .support-message { max-width: 72%; }
}
@media (max-width: 370px) {
  .support-messages { padding: 12px; scrollbar-gutter: auto; }
  .support-message { max-width: 92%; }
  .support-composer > .button { width: 100%; }
}

/* Order statistics and committed live-wallet business views. */
.statistics-filter { margin-bottom: 14px; box-shadow: none; }
.statistics-date-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.statistics-filter .field { margin-bottom: 12px; }
.statistics-filter .field-help { margin-bottom: 14px; }
#statistics-feedback, #live-wallet-history-feedback { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#statistics-feedback .button, #live-wallet-history-feedback .button { flex: none; }
.statistics-summary { box-shadow: none; }
.statistics-count-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.statistics-count-grid > div { min-width: 0; padding: 12px 8px; background: #f7f8fa; border-radius: 10px; text-align: center; }
.statistics-count-grid span, .statistics-count-grid strong, .statistics-amount-grid span, .statistics-amount-grid strong { display: block; }
.statistics-count-grid span, .statistics-amount-grid span { color: var(--text-soft); font-size: 10px; }
.statistics-count-grid strong { margin-top: 6px; font-size: 20px; overflow-wrap: anywhere; }
.statistics-amount-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.statistics-amount-grid > div { min-width: 0; padding: 13px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 10px; }
.statistics-amount-grid strong { margin-top: 7px; color: var(--primary-dark); font-size: 17px; overflow-wrap: anywhere; }
.statistics-amount-grid small { display: block; margin-top: 6px; color: var(--text-soft); font-size: 9px; line-height: 1.45; }
.statistics-basis { color: #315f91; }
.statistics-daily { margin-top: 20px; }
.statistics-table-wrap { display: none; max-width: 100%; overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-small); }
.statistics-table { width: 100%; min-width: 900px; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.statistics-table th, .statistics-table td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.statistics-table th { color: var(--text-soft); background: #f7f8fa; font-size: 10px; font-weight: 650; }
.statistics-table th:first-child, .statistics-table td:first-child { text-align: left; }
.statistics-table tbody tr:last-child td { border-bottom: 0; }
.statistics-daily-cards { display: grid; gap: 10px; }
.statistics-day-card { box-shadow: none; }
.statistics-day-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.statistics-day-heading h3 { margin: 0; font-size: 14px; }
.statistics-day-heading > strong { color: var(--primary-dark); font-size: 12px; }
.statistics-day-card dl { margin: 0; }
.statistics-day-card dl > div { display: grid; grid-template-columns: minmax(110px, 0.9fr) minmax(0, 1.1fr); gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 11px; }
.statistics-day-card dt { color: var(--text-soft); }
.statistics-day-card dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.statistics-pagination { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

.live-wallet-balance { box-shadow: none; }
.live-wallet-balance-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.live-wallet-balance-grid > div { min-width: 0; padding: 15px; background: var(--info-soft); border: 1px solid #dbe8f7; border-radius: var(--radius-small); }
.live-wallet-balance-grid span, .live-wallet-balance-grid strong { display: block; }
.live-wallet-balance-grid span { color: var(--text-soft); font-size: 11px; }
.live-wallet-balance-grid strong { margin-top: 7px; color: var(--info); font-size: 25px; overflow-wrap: anywhere; }
.live-transfer-panel { margin-top: 14px; box-shadow: none; }
.live-transfer-panel .notice { margin-top: 0; }
#live-transfer-status { overflow-wrap: anywhere; }
.live-wallet-history { margin-top: 20px; }
.live-wallet-history .section-heading p { overflow-wrap: anywhere; }
.live-ledger-card { box-shadow: none; }
.live-ledger-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.live-ledger-head > div { min-width: 0; }
.live-ledger-head > div > strong, .live-ledger-head > div > small { display: block; overflow-wrap: anywhere; }
.live-ledger-head > div > strong { font-size: 12px; }
.live-ledger-head > div > small { margin-top: 4px; color: var(--text-soft); font-size: 10px; }
.live-ledger-amount { flex: none; max-width: 52%; font-size: 18px; overflow-wrap: anywhere; }
.live-ledger-amount.is-debit { color: var(--danger); }
.live-ledger-amount.is-credit { color: var(--success); }
.live-ledger-details { margin: 13px 0 0; }
.live-ledger-details > div { display: grid; grid-template-columns: minmax(82px, 0.55fr) minmax(0, 1.45fr); gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 10px; }
.live-ledger-details dt { color: var(--text-soft); }
.live-ledger-details dd { margin: 0; text-align: right; overflow-wrap: anywhere; word-break: break-all; }
#live-wallet-history-more { margin-top: 12px; }
#live-transfer-confirm-request-id { word-break: break-all; }

@media (min-width: 768px) {
  .statistics-table-wrap { display: block; }
  .statistics-daily-cards { display: none; }
}
@media (max-width: 560px) {
  .statistics-count-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .statistics-amount-grid { grid-template-columns: 1fr; }
  .statistics-date-fields { grid-template-columns: 1fr; gap: 0; }
}
@media (max-width: 370px) {
  .live-wallet-balance-grid { grid-template-columns: 1fr; }
  .live-ledger-head { flex-direction: column; }
  .live-ledger-amount { max-width: 100%; }
}

.confirm-dialog { width: min(92vw, 480px); max-height: 88vh; padding: 0; color: var(--text); background: #fff; border: 0; border-radius: 22px; box-shadow: 0 24px 80px rgba(15, 20, 28, 0.3); }
.confirm-dialog::backdrop { background: rgba(20, 25, 32, 0.58); backdrop-filter: blur(3px); }
.confirm-dialog form { padding: 22px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dialog-head h2 { font-size: 20px; }
.dialog-head .icon-button { margin: -10px -10px 0 0; color: var(--text-soft); font-size: 26px; }
#confirm-description { margin: 16px 0; color: var(--text-soft); font-size: 13px; }
.confirm-summary { padding: 12px 14px; background: #f7f8fa; border-radius: 12px; }
.confirm-summary > div { display: flex; justify-content: space-between; gap: 12px; margin: 5px 0; font-size: 12px; }
.confirm-summary dt { color: var(--text-soft); }
.confirm-summary dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.confirm-check { display: flex; align-items: flex-start; gap: 9px; margin: 16px 0; padding: 12px; color: #76500e; background: #fff6e6; border-radius: 12px; font-size: 12px; line-height: 1.5; }
.confirm-check input { width: 18px; height: 18px; flex: none; margin: 0; accent-color: var(--primary); }
.dialog-boundary { margin: 12px 0 0; color: var(--text-soft); font-size: 10px; text-align: center; }
.toast { position: fixed; z-index: 200; right: 16px; bottom: calc(88px + var(--safe-bottom)); left: 16px; max-width: 500px; margin: auto; padding: 13px 16px; color: #fff; background: #333b47; border-radius: 12px; box-shadow: 0 10px 35px rgba(20, 25, 32, 0.25); font-size: 12px; line-height: 1.55; text-align: center; }
.toast[data-tone="success"] { background: #176e50; }
.toast[data-tone="warning"] { background: #8b5510; }

@media (min-width: 561px) {
  .reconciliation-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .agent-body { min-height: 100vh; }
  .agent-main { padding-right: 22px; padding-left: 22px; }
  .bottom-nav { border-right: 1px solid var(--line); border-left: 1px solid var(--line); }
}

@media (min-width: 1024px) {
  .app-page[data-page="home"] > #dashboard-feedback { grid-column: 1 / -1; }
  .app-page[data-page="home"] > .wallet-card { grid-column: 1 / 8; margin: 0 0 20px; }
  .app-page[data-page="home"] > .reconciliation-card { grid-column: 8 / 13; margin: 0 0 20px; }
  .wallet-grid strong { font-size: 30px; }
  .app-page[data-page="profile"] > .profile-menu { grid-column: 1; margin: 0; }
  .profile-menu { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
  .profile-menu .menu-section { margin: 0; }
  .app-page[data-page="credit"] { max-width: 1100px; }
  .credit-request-panel { padding: 24px; }
}

@media (max-width: 370px) {
  .agent-main { padding-right: 12px; padding-left: 12px; }
  .wallet-grid { grid-template-columns: 1fr; }
  .wallet-card, .reconciliation-card { padding: 16px; }
  .balance-card { padding-right: 16px; padding-left: 16px; }
  .balance-grid { gap: 10px; }
  .balance-grid > div + div { padding-left: 10px; }
  .online-status { display: none; }
  .action-panel { grid-template-columns: 1fr; }
  .action-panel .button { grid-column: 1; }
}

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