/* Production agent workspace: quiet, readable and consistent across desktop and mobile. */
:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #1f2937;
  --text-soft: #667085;
  --line: #e4e7ec;
  --primary: #c56a18;
  --primary-dark: #9a4f0e;
  --primary-soft: #fff4e8;
  --success: #18794e;
  --success-soft: #ecf8f2;
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --info: #2557a7;
  --info-soft: #eff5ff;
  --radius: 14px;
  --radius-small: 10px;
  --shadow: 0 2px 8px rgba(16, 24, 40, 0.04);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

body { font-size: 14px; letter-spacing: 0; }
button, a, input, textarea { touch-action: manipulation; }
a { color: var(--primary-dark); }
h1 { font-size: 26px; font-weight: 650; }
h2 { font-weight: 650; }
p { line-height: 1.6; }

.button {
  min-height: 42px;
  border-radius: 9px;
  font-weight: 600;
  box-shadow: none;
  transition: background-color 120ms ease, border-color 120ms ease;
}
.button:active:not(:disabled) { transform: none; }
.button-primary { color: #fff; background: var(--primary); border-color: var(--primary); }
.button-primary:hover:not(:disabled) { background: #ad5b13; border-color: #ad5b13; }
.button-secondary { color: var(--primary-dark); background: var(--primary-soft); border-color: #f0d6ba; }
.button-ghost { color: #475467; background: #fff; border-color: #d0d5dd; }
.button-danger-ghost { color: var(--danger); background: #fff; border-color: #f1c7c3; }
.button-small { min-height: 34px; }
.panel, .order-card { background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); }
.panel { border-radius: var(--radius); }
.icon-button { color: #475467; }
.nav-icon {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}

.connection-banner { padding: 10px 16px; color: #344054; background: #f2f4f7; border-bottom: 1px solid var(--line); }
.connection-banner[data-state="error"] { color: #912018; background: #fff1f0; border-color: #f4c7c3; }
.connection-banner[data-state="success"] { color: #05603a; background: #ecf8f2; }

.login-view { background: #f4f6f8; }
.login-brand .brand-mark, .desktop-brand .brand-mark {
  color: #fff;
  background: #17233b;
  border-radius: 11px;
  box-shadow: none;
}
.version-pill { color: #475467; background: #fff; border-color: var(--line); }
.login-hero .eyebrow { color: var(--primary-dark); }
.login-hero h1 { color: #17233b; font-weight: 650; letter-spacing: -0.035em; }
.login-hero > p:last-of-type { color: var(--text-soft); }
.login-feature-list li { border-color: var(--line); }
.login-feature-list li::before { background: var(--primary); }
.login-feature-list span { color: var(--text-soft); }
.login-panel { padding: 26px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 32px rgba(16, 24, 40, 0.07); }
.login-panel-heading { margin-bottom: 24px; }
.login-panel-heading h2 { margin: 0 0 7px; font-size: 20px; }
.login-panel-heading p { margin: 0; color: var(--text-soft); font-size: 13px; }
.login-panel .field input { border-color: #d0d5dd; border-radius: 9px; }
.login-panel .field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(197, 106, 24, 0.12); }
.login-panel .field-help, .login-boundary, .login-footer { color: #7a8494; }
.login-boundary { margin-top: 14px; }
.login-feature-list { display: none !important; }

.agent-header { color: var(--text); background: #fff; border-bottom: 1px solid var(--line); }
.agent-header-main { min-height: 64px; }
.agent-avatar { color: #344054; background: #eef2f6; border: 0; font-size: 13px; }
.agent-identity strong { color: var(--text); }
.agent-identity div > span { color: var(--text-soft); }
.agent-header .icon-button, .header-back { color: #475467; }
.agent-header .icon-button:hover { background: #f2f4f7; }
.online-status { color: var(--success); }
.header-notice { color: var(--text-soft); background: #fafbfc; }
.page-heading h1 { font-weight: 650; letter-spacing: -0.025em; }
.eyebrow { color: #7a8494; font-size: 10px; font-weight: 650; }
.page-description { margin: -6px 0 18px; color: var(--text-soft); font-size: 12px; }

.direction-switch { padding: 3px; background: #eef1f4; border: 0; border-radius: 10px; }
.direction-switch button { min-height: 38px; color: var(--text-soft); border-radius: 8px; font-size: 13px; }
.direction-switch button.active { color: var(--primary-dark); background: #fff; box-shadow: 0 1px 4px rgba(16, 24, 40, 0.08); }
.filter-chips { gap: 8px; border: 0; }
.filter-chips button { min-height: 34px; padding: 6px 13px; color: var(--text-soft); background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.filter-chips button.active { color: var(--primary-dark); background: var(--primary-soft); border-color: #eac9a6; font-weight: 600; }
.filter-chips button.active::after { content: none; }
.search-form input, .chat-composer textarea { border-color: #d0d5dd; border-radius: 9px; }
.list-summary { min-height: 18px; color: var(--text-soft); }

.balance-card {
  padding: 22px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.balance-card::after { content: none; }
.balance-card-top, .balance-equivalent { color: var(--text-soft); }
.balance-rate { color: var(--text-soft); }
.balance-total { color: #17233b; font-size: 34px; font-weight: 650; }
.balance-grid { border-color: var(--line); }
.balance-grid > div + div { border-color: var(--line); }
.balance-grid span, .balance-grid small { color: var(--text-soft); }
.balance-grid strong { color: var(--primary-dark); font-weight: 650; }
.balance-explanation { color: #7a8494; }
.accepting-panel { background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); }
.accepting-panel strong { color: #344054; }
.accepting-panel p { color: var(--text-soft); }
.switch { color: #475467; background: #e4e7ec; }
.switch.is-on { color: #fff; background: var(--success); }

.order-card { border-radius: 12px; }
.order-card-head { align-items: center; }
.order-kind { color: var(--primary-dark); background: var(--primary-soft); font-weight: 600; }
.order-player { font-weight: 600; }
.order-card-amount strong { color: #17233b; font-weight: 650; }
.order-cny { color: #344054; font-weight: 600; }
.order-card dl, .order-card-foot { border-color: #eef1f4; }
.order-hint { color: var(--text-soft); }
.badge { border-radius: 6px; font-weight: 600; }
.badge-warning { color: #93440d; background: #fff1e3; }
.badge-success { color: #05603a; background: #eaf7f0; }
.badge-info { color: #24579f; background: #edf4ff; }
.badge-danger { color: #a5281f; background: #fff0ef; }
.badge-muted { color: #475467; background: #f0f2f5; }

.empty-state { padding: 40px 20px; color: var(--text-soft); background: #fff; border: 1px dashed #d0d5dd; border-radius: 12px; }
.empty-state-icon { color: #98a2b3; background: #f2f4f7; font-size: 20px; }
.empty-state h3 { color: #344054; font-size: 15px; font-weight: 600; }
.empty-state p { color: var(--text-soft); }
.notice { border-radius: 9px; }
.notification-list { gap: 10px; }
.notification-item { background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: none; }

.profile-card { color: #fff; background: #17233b; border: 0; border-radius: var(--radius); box-shadow: none; }
.profile-avatar { color: #fff; background: #344054; border-radius: 12px; }
.profile-main p, .profile-stats span { color: #c5ccd7; }
.profile-stats { border-color: #3b4658; }
.profile-stats strong { color: #fff; }
.profile-card .badge { color: #e4e7ec; background: #344054; }
.profile-assets { border: 1px solid var(--line); box-shadow: var(--shadow); }
.metric-grid strong { color: #17233b; }
.profile-version { color: var(--text-soft); }

.order-amount-panel { background: #fff; border: 1px solid var(--line); }
.order-amount-panel > strong { color: #17233b; }
.freeze-panel { border-top-color: var(--primary); }
.timeline li::before { background: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.chat-messages { padding: 16px; background: #f4f6f8; border: 1px solid var(--line); border-radius: 12px; }
.chat-message { background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: none; }
.chat-message img { display: block; max-width: min(100%, 280px); max-height: 360px; object-fit: contain; border-radius: 9px; }
.chat-message audio { display: block; max-width: 100%; }
.chat-message p { white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-composer { background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.chat-composer textarea { background: #fff; }
.confirm-dialog { border: 0; border-radius: 16px; box-shadow: 0 20px 70px rgba(16, 24, 40, 0.22); }
.confirm-dialog::backdrop { background: rgba(16, 24, 40, 0.55); }
.safe-action-note, .dialog-boundary { color: var(--text-soft); }
.toast { width: fit-content; max-width: min(320px, calc(100vw - 40px)); padding: 10px 16px; pointer-events: none; background: #344054; border-radius: 9px; }

@media (max-width: 1023px) {
  .agent-body { max-width: 560px; background: var(--bg); }
  .agent-main { padding: 20px 16px calc(90px + var(--safe-bottom)); }
  .page-heading { margin-bottom: 18px; }
  .page-heading h1 { font-size: 22px; }
  .page-heading .eyebrow { display: none; }
  .home-heading h1 { font-size: 22px; }
  .direction-switch { margin-bottom: 16px; }
  .app-page[data-page="home"] { min-height: 0; padding-bottom: 0; transform: none; }
  .balance-card {
    position: static;
    display: block;
    min-height: 0;
    padding: 20px;
    overflow: hidden;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transform: none;
  }
  .balance-card-top { font-size: 11px; }
  .balance-rate { font-size: 10px; }
  .balance-total { margin: 12px 0 4px; font-size: 30px; }
  .balance-equivalent { font-size: 11px; }
  .balance-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); border-left: 0; }
  .balance-grid > div + div { padding-left: 14px; border-left: 1px solid var(--line); }
  .balance-grid span, .balance-grid small { font-size: 10px; }
  .balance-grid strong { margin: 6px 0 3px; font-size: 19px; }
  .balance-explanation { display: block; margin-top: 15px; font-size: 10px; }
  .accepting-panel {
    position: static;
    display: flex;
    margin-top: 12px;
    padding: 16px;
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    transform: none;
  }
  .accepting-panel > div { display: block; }
  .accepting-panel .switch {
    display: flex;
    width: 84px;
    min-width: 84px;
    height: 40px;
    margin: 0;
    padding: 4px 9px 4px 30px;
    color: #475467;
    background: #e4e7ec;
    border: 0;
    border-radius: 22px;
    box-shadow: none;
  }
  .accepting-panel .switch.is-on { padding: 4px 30px 4px 9px; color: #fff; background: var(--success); }
  .accepting-panel .switch-thumb { display: block; }
  .accepting-panel .switch-text { display: inline; }
  .accepting-panel .switch::after { content: none; }
  .accepting-panel .switch:disabled { opacity: 0.55; }
  .order-list { gap: 12px; }
  .order-card { padding: 16px; }
  .filter-chips { margin: 12px -16px; padding: 0 16px 3px; overflow-x: auto; }
  .notification-list { margin-top: 12px; }
  .notification-item { padding: 16px; }
  .profile-card { margin: 0; padding: 22px; border-radius: var(--radius); }
  .profile-assets { margin: 12px 0 16px; padding: 18px; }
  .profile-version { margin-bottom: 12px; }
  .login-view { min-height: 100dvh; padding: 26px 20px calc(30px + var(--safe-bottom)); background: #f4f6f8; }
  .login-brand { justify-content: space-between; }
  .login-hero { margin: 44px 0 24px; text-align: left; }
  .login-hero h1 { margin-bottom: 12px; font-size: 30px; }
  .login-hero > p { font-size: 13px; }
  .login-panel { padding: 22px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); }
  .order-amount-panel { margin: 0; padding: 20px; border-radius: var(--radius); }
  .chat-messages { min-height: 320px; margin: 12px 0; padding: 14px; border-radius: 12px; }
  .chat-composer { margin: 0; padding: 8px; }
  .bottom-nav {
    min-height: 66px;
    max-width: 560px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 7px 8px calc(7px + var(--safe-bottom));
    background: #fff;
    border-top: 1px solid var(--line);
    box-shadow: 0 -2px 10px rgba(16, 24, 40, 0.04);
  }
  .bottom-nav > a { color: #7a8494; gap: 4px; }
  .bottom-nav > a.active { color: var(--primary-dark); background: none; }
  .bottom-nav > a > span { width: 24px; height: 24px; border: 0; background: none; }
  .bottom-nav > a.active > span { background: var(--primary-soft); border: 0; }
  .bottom-nav b { font-size: 10px; font-weight: 500; }
  .toast { bottom: calc(176px + var(--safe-bottom)); }
}

@media (min-width: 1024px) {
  .agent-shell { grid-template-columns: 232px minmax(0, 1fr); }
  .desktop-sidebar { padding: 28px 16px 22px; background: #17233b; border: 0; }
  .desktop-environment { color: #98a2b3; }
  .desktop-environment > span { background: #47a57c; box-shadow: 0 0 0 3px rgba(71, 165, 124, 0.12); }
  .desktop-nav > p { color: #7f8b9d; }
  .desktop-nav > a { min-height: 50px; border-radius: 8px; }
  .desktop-nav > a > span { color: #98a2b3; border-color: #465164; }
  .desktop-nav > a.active { color: #ffd7ae; background: rgba(197, 106, 24, 0.17); border-color: rgba(240, 190, 140, 0.12); }
  .desktop-nav > a.active > span { color: #ffc57f; background: transparent; border-color: #8c623c; }
  .desktop-sidebar-foot { border-color: #344054; }
  .desktop-sidebar-foot strong { color: #d0d5dd; }
  .desktop-sidebar-foot p { color: #98a2b3; }
  .agent-header { backdrop-filter: none; }
  .agent-header-main { min-height: 72px; }
  .agent-main { padding-top: 30px; }
  .online-status { padding: 5px 9px; background: var(--success-soft); }
  .balance-card { position: relative; display: block; min-height: 220px; overflow: hidden; }
  .balance-grid { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); border-left: 0; }
  .balance-explanation { margin-top: 16px; }
  .app-page[data-page="home"] > .accepting-panel { min-height: 220px; }
  .order-card { padding: 20px; }
  .profile-card { padding: 28px !important; background: #17233b; border-radius: var(--radius) !important; }
  .app-page[data-page="profile"] { grid-template-columns: minmax(0, 1fr); max-width: 1100px; }
  .app-page[data-page="profile"] > .profile-assets,
  .app-page[data-page="profile"] > #logout-button,
  .app-page[data-page="profile"] > .profile-version { grid-column: 1; grid-row: auto; }
  .app-page[data-page="profile"] > #logout-button { max-width: 280px; }
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .login-view { background: #f4f6f8; }
  .login-panel { padding: 30px; }
  .chat-messages { min-height: 420px; }
  .toast { bottom: 30px; }
}

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