/* Override the legacy page styles while preserving existing form selectors. */
:root { font-family: "Microsoft YaHei", "Segoe UI", sans-serif; color: #262b30; background: #f5f6f8; }
* { box-sizing: border-box; letter-spacing: 0; }
[hidden] { display: none !important; }
body { display: block; place-items: normal; padding: 0; margin: 0; font-size: 14px; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 232px; background: #fff; border-right: 1px solid #e3e6ea; display: flex; flex-direction: column; z-index: 30; }
.brand { display: flex; align-items: center; gap: 12px; padding: 27px 24px; color: #242b30; text-decoration: none; font-size: 19px; font-weight: 700; }
.brand small { display: block; font-size: 11px; color: #8b949c; font-weight: 400; margin-top: 4px; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; background: #18785b; color: #fff; border-radius: 8px; }
.sidebar nav { padding: 16px 12px; display: grid; gap: 6px; }
.sidebar nav a { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 13px; border-radius: 6px; text-decoration: none; color: #68737d; font-size: 14px; }
.sidebar nav a:hover { background: #f4f6f7; color: #242b30; }
.sidebar nav a[aria-current="page"] { background: #eaf5ef; color: #18785b; font-weight: 600; }
.sidebar nav svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar .nav-arrow { margin-left: auto; width: 14px; visibility: hidden; }
.sidebar a[aria-current="page"] .nav-arrow { visibility: visible; }
.sidebar-footer { margin-top: auto; border-top: 1px solid #edf0f2; padding: 20px 25px; display: flex; gap: 9px; align-items: center; color: #76818a; }
.connection-dot { width: 7px; height: 7px; display: inline-block; background: #a8b0b7; border-radius: 50%; flex-shrink: 0; }
.connection-dot.connected { background: #2c9c6b; }
.workspace { margin-left: 232px; width: calc(100% - 232px); min-width: 0; }
.workspace-header { position: sticky; top: 0; z-index: 20; height: 72px; padding: 0 32px; border-bottom: 1px solid #e3e6ea; background: #fff; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.header-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.header-left > svg { width: 14px; color: #a3abb3; }
.breadcrumb { color: #8b949c; }
.session-status { display: flex; align-items: center; gap: 7px; font-size: 12px; color: #728078; white-space: nowrap; }
main.content { width: 100%; max-width: 1440px; padding: 30px 32px 64px; margin: auto; }
main section { background: transparent; border: 0; box-shadow: none; border-radius: 0; padding: 0; margin: 0; }
main section + section { margin-top: 0; }
main section[data-view]:not([hidden]) ~ section[data-view]:not([hidden]) { margin-top: 28px; }
h1 { font-size: 23px; line-height: 1.4; margin-bottom: 8px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { overflow-wrap: anywhere; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 22px; border-bottom: 1px solid #e3e6ea; margin-bottom: 24px; }
.section-heading > svg { color: #9da7af; width: 22px; }
.section-heading h1, .section-heading p { margin: 0; }
.section-heading p { margin-top: 6px; }
input, textarea, select { background: #fff; border: 1px solid #d8dde2; border-radius: 5px; width: 100%; padding: 10px 12px; font-size: 14px; }
input:focus, textarea:focus { border-color: #18785b; outline: 3px solid #18785b15; }
label { margin-top: 18px; color: #424e57; }
button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; width: auto; min-height: 40px; margin-top: 18px; padding: 9px 16px; font-size: 14px; background: #18785b; border-radius: 5px; }
button:hover { background: #116045; }
button svg { width: 16px; height: 16px; flex-shrink: 0; }
button.secondary { background: #fff; color: #53616d; border: 1px solid #d8dde2; }
button.secondary:hover { background: #f0f3f5; }
button.danger { background: #b64148; }
button.danger:hover { background: #973239; }
.icon-button { height: 36px; width: 36px; min-height: 36px; padding: 8px; margin: 0; background: transparent; color: #424e57; }
.icon-button:hover { background: #f0f3f5; }
.mobile-toggle { display: none; }
.compact-form { max-width: 600px; margin-top: 24px; }
.config-details { margin: 0; max-width: 780px; }
.config-details > div { display: grid; grid-template-columns: 120px minmax(0,1fr); gap: 16px; padding: 14px 0; border-bottom: 1px solid #e6e9ed; }
.config-details dt { color: #828d97; }
.config-details dd { margin: 0; overflow-wrap: anywhere; }
.status-inline { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: #18785b; }
.check-row { display: flex; align-items: center; gap: 9px; margin-top: 16px; color: #53616d; }
.check-row input { width: 16px; height: 16px; padding: 0; accent-color: #18785b; }
.connection-actions { display: flex; gap: 10px; margin-top: 18px; }
.connection-actions button { margin: 0; min-width: 96px; }
.message { margin: 0 0 24px; }
.inline-actions { display: flex; gap: 10px; margin: 0 0 20px; }
#auto-status { display: grid; grid-template-columns: minmax(0,1fr); }
#auto-status p { margin: 6px 0; }
#auto-status details { margin-top: 12px; }
.auto-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 0 0 24px; }
.mode-selector { display: flex; align-items: center; gap: 6px; border: 0; padding: 4px; margin: 0; background: #e7ecef; border-radius: 6px; }
.mode-selector legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.mode-selector label { display: flex; align-items: center; gap: 7px; margin: 0; padding: 9px 18px; cursor: pointer; border-radius: 4px; font-weight: 400; }
.mode-selector label:has(input:checked) { background: #fff; color: #18785b; box-shadow: 0 1px 3px #242b3010; }
.mode-selector input { width: 14px; height: 14px; accent-color: #18785b; padding: 0; }
.mode-selector:disabled label { cursor: default; }
.auto-command-buttons { display: flex; gap: 10px; }
.auto-command-buttons button { margin: 0; }
button:disabled { opacity: .5; cursor: default; }
.real-mode-confirm { width: 100%; margin: 0; color: #a3433e; }
.auto-run-strip { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 20px; padding: 18px 0; border-top: 1px solid #e0e5e8; color: #849099; font-size: 13px; }
.auto-run-strip strong { margin-left: 6px; color: #3c4c57; font-weight: 500; }
.run-badge { color: #18785b; background: #e4f2eb; padding: 5px 9px; border-radius: 4px; }
.mode-badge { color: #626e78; }
.auto-heartbeat { margin-left: auto; }
.auto-metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); padding: 24px 0; border-top: 1px solid #e0e5e8; border-bottom: 1px solid #e0e5e8; }
.auto-metrics > div { padding: 0 22px; border-right: 1px solid #e0e5e8; min-width: 0; }
.auto-metrics > div:first-child { padding-left: 0; }
.auto-metrics > div:last-child { border-right: 0; }
.auto-metrics span { color: #7d8b94; font-size: 12px; }
.auto-metrics strong { display: block; font-size: 25px; font-weight: 600; margin-top: 12px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.profit-positive { color: #18785b; }
.profit-negative { color: #b64148; }
.auto-summary { display: flex; flex-wrap: wrap; gap: 12px 24px; padding: 18px 0 8px; color: #7d8b94; font-size: 12px; }
.auto-plan-table { min-width: 800px; table-layout: auto; }
.auto-plan-table th { width: auto; white-space: nowrap; background: #edf1f3; font-size: 12px; }
.auto-plan-table td { font-variant-numeric: tabular-nums; }
.auto-plan-table th, .auto-plan-table td { padding: 15px 14px; }
.auto-plan-table .auto-detail-row td { color: #87939b; font-size: 12px; background: #fafbfc; line-height: 1.7; padding: 10px 14px; }
.auto-empty { text-align: center; color: #9ca6ae; padding: 40px !important; }
.auto-logs { margin-top: 22px !important; }
.auto-error { padding: 10px 12px; border-radius: 4px; }
summary { cursor: pointer; color: #63747e; padding: 8px 0; }
.plan-layout { display: grid; grid-template-columns: minmax(260px, .85fr) minmax(0,1.15fr); gap: 36px; margin-top: 20px; }
.plan-editor { min-width: 0; }
#plan-form { scroll-margin-top: 96px; }
.saved-plans { min-width: 0; border-left: 1px solid #e1e6eb; padding-left: 30px; }
.saved-plans h3 { margin: 0; }
.count-label { margin-left: 6px; color: #8c969e; font-weight: 400; }
.plan-list { gap: 14px; }
.plan-item { background: #fff; padding: 18px; border-radius: 6px; }
.plan-number-preview { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-height: 3.2em; overflow-wrap: anywhere; }
.profit-limit-controls { display: flex; flex-wrap: wrap; gap: 12px; border: 0; padding: 0; margin: 0; min-width: 0; }
.profit-limit-controls legend { font-size: 12px; color: #59636a; margin-bottom: 8px; }
.profit-limit-controls label { margin: 0; flex: 1 1 130px; font-size: 13px; }
.profit-limit-controls input { width: 100%; max-width: 180px; }
.plan-head { flex-wrap: wrap; }
.plan-actions { align-items: center; }
.plan-actions button { flex: 0 1 auto; }
.plan-status { gap: 20px; }
.member-table { background: #fff; margin-top: 22px; table-layout: fixed; }
.member-table th, .member-table td { padding: 15px 18px; border-color: #e6e9ed; overflow-wrap: anywhere; }
.member-table th { color: #78858f; font-weight: 400; }
.member-table tr:last-child td, .member-table tr:last-child th { border-bottom: 0; }
.member-table th { width: 28%; }
.period-grid { display: grid; grid-template-columns: minmax(0,1fr); gap: 1px; background: #e3e8eb; border: 1px solid #e3e8eb; border-radius: 8px; overflow: hidden; max-width: 900px; }
.period-grid p { margin: 0; min-height: 0; padding: 18px 20px; background: #fff; color: #7b8790; }
.period-grid p:first-child strong { margin-left: 12px; font-size: 21px; }
.period-grid p span, .period-grid p:not(.meta) > span { color: #34434d; font-weight: 600; font-variant-numeric: tabular-nums; }
.period-grid form { padding: 16px 20px; background: #fff; }
.period-grid form button { margin: 0; }
.live-label { display: flex; align-items: center; gap: 7px; color: #7d888f; font-size: 12px; }
.section-heading button { margin: 0; }
.table-scroll { overflow-x: auto; }
.history-table { min-width: 610px; table-layout: auto; margin-top: 8px; }
.history-table th { width: auto; }
.history-table thead { background: #edf1f3; }
.odds-toolbar { display: flex; align-items: center; gap: 16px; }
.odds-table { min-width: 1000px; table-layout: auto; font-variant-numeric: tabular-nums; }
.odds-table th { width: auto; white-space: nowrap; font-size: 12px; }
.odds-table td { white-space: nowrap; }
.odds-table thead { background: #edf1f3; }
.odds-table th, .odds-table td { padding: 12px; }
dialog { width: min(600px, calc(100% - 32px)); max-height: calc(100dvh - 48px); overflow: auto; padding: 24px; border: 1px solid #d8dde2; border-radius: 8px; background: #fff; color: #262b30; }
dialog::backdrop { background: #20283066; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; position: sticky; top: -24px; padding: 12px 0; background: #fff; }
#odds-details dt { overflow-wrap: anywhere; }
.draw-digits { display: flex; gap: 6px; }
.draw-digit { display: grid; place-items: center; background: #eaf5ef; color: #237455; border-radius: 50%; width: 28px; height: 28px; font-weight: 600; font-variant-numeric: tabular-nums; }
.warning { color: #965725; background: #fff8ec; border-color: #edddbe; max-width: 780px; }
.bet-context { display: flex; flex-wrap: wrap; gap: 12px 24px; padding: 18px 0; color: #75818a; }
.bet-context strong { color: #414e57; margin-left: 5px; font-variant-numeric: tabular-nums; }
.login-required { padding: 80px 0; text-align: center; color: #a2acb5; }
.login-required > svg { width: 32px; height: 32px; }
.text-link { color: #18785b; text-decoration: none; }
:focus-visible { outline: 2px solid #18785b; outline-offset: 3px; }
@media (max-width: 1100px) {
    .sidebar { width: 210px; }
    .workspace { margin-left: 210px; width: calc(100% - 210px); }
    main.content, .workspace-header { padding-left: 24px; padding-right: 24px; }
    .plan-layout { grid-template-columns: minmax(0,1fr); gap: 28px; }
    .saved-plans { border-left: 0; border-top: 1px solid #e1e6eb; padding: 24px 0 0; }
}
@media (max-width: 700px) {
    .auto-controls { align-items: stretch; gap: 14px; }
    .mode-selector { width: 100%; }
    .mode-selector label { flex: 1; justify-content: center; }
    .auto-command-buttons { width: 100%; }
    .auto-command-buttons button { flex: 1; padding: 9px 10px; }
    .auto-heartbeat { width: 100%; margin: 0; }
    .auto-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 24px 0; }
    .auto-metrics > div { padding: 0 14px; }
    .auto-metrics > div:nth-child(odd) { padding-left: 0; }
    .auto-metrics > div:nth-child(even) { border-right: 0; }
    .auto-metrics strong { font-size: 23px; }
    .auto-plan-table { display: block; min-width: 0; background: transparent; }
    .auto-plan-table thead { display: none; }
    .auto-plan-table tbody { display: block; }
    .auto-plan-table tr { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); background: #fff; padding: 12px 6px; border: 1px solid #e1e6eb; border-bottom: 0; }
    .auto-plan-table td { display: block; width: auto; padding: 9px !important; border: 0; }
    .auto-plan-table td[data-label]::before { content: attr(data-label); display: block; color: #8c969e; font-size: 11px; padding-bottom: 5px; }
    .auto-plan-table .auto-detail-row { display: block; border-bottom: 1px solid #e1e6eb; margin-bottom: 16px; padding: 0 6px 6px; }
    .auto-plan-table .auto-detail-row td { background: #fff; }
    .sidebar { position: fixed; top: 60px; width: 100%; height: auto; bottom: auto; display: none; border-right: 0; border-bottom: 1px solid #dce2e7; box-shadow: 0 8px 18px #242b3010; }
    .sidebar.is-open { display: flex; }
    .sidebar .brand, .sidebar-footer { display: none; }
    .sidebar nav { padding: 12px 16px; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 5px; }
    .sidebar nav a { padding: 0 10px; font-size: 13px; gap: 8px; }
    .sidebar .nav-arrow { display: none; }
    .workspace { margin-left: 0; width: 100%; }
    .workspace-header { height: 60px; padding: 0 16px; }
    .header-left { gap: 8px; }
    .breadcrumb, .header-left > svg { display: none; }
    .mobile-toggle { display: inline-flex; }
    main.content { padding: 24px 18px 48px; }
    h1 { font-size: 21px; }
    .config-details > div { grid-template-columns: 84px minmax(0,1fr); gap: 12px; }
    .period-grid { grid-template-columns: minmax(0,1fr); gap: 1px; }
    .period-grid p { min-height: 0; padding: 16px; }
    .period-grid form { padding: 16px; }
    .member-table th, .member-table td { padding: 12px; }
    .plan-item { padding: 14px; }
    .section-heading { gap: 10px; }
    .session-status { font-size: 11px; }
    .inline-actions button { flex: 1; }
}
