:root {
  --bg: #f8f9fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #687386;
  --line: #e5e8ec;
  --blue: #2563eb;
  --green: #159957;
  --red: #d92d20;
  --amber: #b7791f;
  --violet: #6554c0;
  --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Microsoft YaHei", system-ui, sans-serif; background: var(--bg); color: var(--ink); }
button, input, select { font: inherit; }
textarea { font: inherit; }
button { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 13px; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
button:hover { border-color: #c0c7d0; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.primary:hover { box-shadow: 0 2px 8px rgba(37,99,235,.25); }
.remember-login { color: #1d4ed8; background: #eef4ff; border-color: #b9cdfc; }
.danger { background: #fff3f2; color: var(--red); border-color: #f7b4ad; }
.is-hidden { display: none !important; }
.eyebrow { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; margin: 0 0 4px; }

.login-view { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 1.1fr) minmax(320px, .9fr); }
.brand-panel { background: #172033; color: #fff; display: flex; flex-direction: column; justify-content: center; padding: 64px; position: relative; overflow: hidden; }
.brand-panel h1 { font-size: 36px; margin: 18px 0 12px; letter-spacing: 0; }
.brand-panel p { max-width: 520px; color: #cad4e2; font-size: 17px; line-height: 1.7; }
.brand-mark { width: 72px; height: 72px; border-radius: 14px; background: #fff; color: #172033; display: grid; place-items: center; font-size: 26px; font-weight: 800; }
.login-card { display: flex; flex-direction: column; justify-content: center; gap: 16px; padding: 64px; max-width: 520px; width: 100%; margin: auto; }
.login-card h2 { margin: 0; font-size: 28px; }
label { display: grid; gap: 7px; color: #374151; font-size: 13px; }
input, select { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 13px 14px; background: #fff; color: var(--ink); transition: border-color .15s, box-shadow .15s; outline: none; }
input:focus, select:focus { border-color: #93b4f5; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
textarea { width: 100%; resize: vertical; min-height: 140px; border: 1px solid var(--line); border-radius: 10px; padding: 13px 14px; background: #fff; color: var(--ink); line-height: 1.7; transition: border-color .15s, box-shadow .15s; outline: none; }
textarea:focus { border-color: #93b4f5; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.captcha-row { display: grid; grid-template-columns: minmax(0, 1fr) 142px; gap: 8px; align-items: center; }
.captcha-image { height: 46px; padding: 0; overflow: hidden; background: #f7f9fc; border-radius: 10px; }
.captcha-image img { display: block; width: 142px; height: 46px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.segmented .active, .filters .active, nav .active { background: #e8f0ff; color: #1d4ed8; border-color: #b9cdfc; }

.dashboard { min-height: 100vh; display: block; background: #dbe4f0; }
.customer-header { min-height: 56px; padding: 11px 28px; background: #fff; display: flex; align-items: center; justify-content: space-between; gap: 18px; box-shadow: 0 1px 5px rgba(30, 45, 70, .08); }
.system-name { padding: 0; display: flex; align-items: center; gap: 8px; }
.system-name b { color: #2563eb; font-size: 18px; }
.customer-header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.customer-header-actions button { border: 0; background: #e7ebf2; padding: 7px 13px; border-radius: 8px; font-size: 13px; }
.customer-header-actions .primary { background: #2f6ded; color: #fff; }
.balance-chip { border-radius: 7px; padding: 6px 11px; font-size: 13px; font-weight: 600; }
.balance-chip.normal { background: #e8f0ff; color: #1d4ed8; }
.balance-chip.absolute { background: #ffe8f0; color: #c0265b; }
#currentUser { color: #6b7280; font-size: 13px; }
.customer-nav { padding: 0 24px; background: #d3ddec; border-top: 1px solid #edf1f7; border-bottom: 1px solid #cbd6e6; }
nav { height: 56px; display: flex; align-items: center; gap: 8px; }
nav button { width: auto; min-width: 98px; text-align: center; background: #fff; border: 1px solid #d9e0ea; border-radius: 8px; padding: 10px 18px; color: #374151; }
nav .active { background: #2f6ded; border-color: #2f6ded; color: #fff; box-shadow: none; }
nav .recharge-tab { background: #ff7a1a; border-color: #ff7a1a; color: #fff; font-weight: 700; box-shadow: 0 4px 12px rgba(249,115,22,.26); }
nav .recharge-tab.active { background: #ff7a1a; border-color: #ff7a1a; color: #fff; }
.workspace { padding: 16px; min-width: 0; }
.notice-board { margin: 0 auto 18px; max-width: none; min-height: 128px; border: 1px solid #f2ca52; border-radius: 8px; background: #fffbed; padding: 25px 48px; display: grid; grid-template-columns: minmax(0, 1fr) 34px; gap: 10px; align-items: start; text-align: center; }
.notice-icon { display: none; }
.notice-copy { min-width: 0; }
.notice-copy strong { display: block; color: #00bcd4; margin-bottom: 7px; font-size: 25px; font-weight: 800; }
.notice-copy p { margin: 0; color: #0736bf; font-size: 22px; font-weight: 800; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.notice-close { width: 32px; height: 32px; padding: 0; border: 0; background: transparent; color: #7a6b51; font-size: 22px; }
.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 14px 0; }
.customer-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.summary-grid article, .machine-card, .tab-panel, .admin-grid article, .rank-card, .plan-card, .card-form, .admin-device-form { background: var(--panel); border: none; border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.summary-grid article { padding: 14px; display: grid; gap: 5px; }
.summary-grid span, small { color: var(--muted); }
.summary-grid b { font-size: 24px; }
.tab-panel { max-width: 1152px; margin: 0 auto; padding: 0; background: transparent; border-radius: 0; box-shadow: none; }
.panel-head { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 12px; margin: 0 0 12px; }
.panel-head h3 { margin: 0; }
.panel-head small { color: #718096; }
.panel-actions { justify-self: end; display: flex; gap: 8px; flex-wrap: wrap; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; grid-column: 1 / -1; }
.filters button { border: 0; background: #e9eef6; border-radius: 6px; padding: 8px 14px; font-size: 13px; }
.filters .active { background: #2f6ded; color: #fff; border-color: #2f6ded; }
.refresh-inline { justify-self: end; border: 0; border-radius: 6px; background: #e9eef6; padding: 8px 15px; font-size: 13px; }
.machine-grid, .recharge-grid, .rank-layout, .admin-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px 22px; }
.machine-card, .plan-card, .rank-card, .admin-grid article { padding: 20px; display: grid; gap: 10px; }
.machine-card { min-height: 136px; border-top: 4px solid #f59e0b; border-radius: 12px; box-shadow: none; }
.machine-card.free { border-top-color: #22c55e; }
.machine-card.busy,
.machine-card.maintenance,
.machine-card.stop_requested { border-top-color: #f59e0b; }
.machine-card.offline,
.machine-card.closed { border-top-color: #cbd5e1; }
.machine-card header { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.machine-card h4, .plan-card h4 { margin: 0; font-size: 17px; }
.status { width: max-content; border-radius: 999px; padding: 4px 9px; font-size: 12px; }
.free { background: #e8f7ef; color: var(--green); }
.maintenance { background: #eef4ff; color: var(--blue); }
.busy { background: #fff7e6; color: var(--amber); }
.stop_requested { background: #fff7e6; color: var(--amber); max-width: 100%; white-space: normal; }
.offline { background: #f1f3f6; color: #667085; }
.closed { background: #fef2f2; color: #b42318; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tags span { background: #e8f2ff; border: 0; border-radius: 6px; padding: 6px 10px; font-size: 13px; color: #1d4ed8; }
.machine-remain { margin: 0; color: #f97316; font-size: 13px; }
.machine-coins { margin: -2px 0 0; color: #475467; font-size: 13px; }
.machine-address-btn { width: max-content; border: 0; background: #e8f2ff; color: #1d4ed8; border-radius: 6px; padding: 7px 11px; font-size: 13px; }
.machine-address-btn:hover { border: 0; background: #dbeafe; box-shadow: none; }
.machine-card .primary { margin-top: 4px; border-radius: 8px; }
.machine-card .primary:disabled { display: none; }
.table-wrap { overflow: auto; border: none; border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
table { width: 100%; border-collapse: collapse; min-width: 760px; background: #fff; }
th, td { text-align: left; border-bottom: 1px solid var(--line); padding: 11px 12px; white-space: nowrap; }
th { background: #fafbfc; color: #475467; font-size: 13px; }
.card-form { margin-top: 12px; padding: 14px; display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 12px; }
.card-recharge-panel { max-width: 720px; margin-top: 0; }
.card-recharge-panel p { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 13px; }
.admin-device-form { padding: 14px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; align-items: end; gap: 12px; margin-bottom: 12px; }
.admin-device-table { margin-bottom: 12px; }
.admin-user-table table { min-width: 980px; }
.admin-ticket-table table { min-width: 1050px; }
.order-actions { display: flex; gap: 6px; align-items: center; }
.admin-balance-form { display: grid; grid-template-columns: 92px 92px auto; gap: 6px; align-items: center; }
.admin-balance-form input { padding: 8px 9px; }
.notice-form { display: grid; gap: 14px; max-width: 760px; }
.notice-switch { display: flex; align-items: center; gap: 9px; width: max-content; font-size: 14px; }
.notice-switch input { width: 18px; height: 18px; }
.notice-form-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
dialog { border: 0; border-radius: var(--radius); padding: 0; width: min(420px, calc(100vw - 32px)); box-shadow: 0 8px 30px rgba(0,0,0,.12); }
dialog::backdrop { background: rgba(17, 24, 39, .48); }
.modal { padding: 18px; display: grid; gap: 14px; }
.modal h3, .modal p { margin: 0; }
menu { display: flex; justify-content: flex-end; gap: 8px; padding: 0; margin: 0; }
#toast { position: fixed; right: 18px; bottom: 18px; background: #172033; color: #fff; padding: 11px 14px; border-radius: 12px; opacity: 0; transform: translateY(10px); transition: .2s; pointer-events: none; max-width: 360px; box-shadow: 0 4px 14px rgba(0,0,0,.15); }
#toast.show { opacity: 1; transform: translateY(0); }
@media (max-width: 920px) {
  .login-view { grid-template-columns: 1fr; }
  .brand-panel { min-height: 340px; padding: 32px; }
  .customer-header { display: grid; padding: 12px 14px; }
  .customer-header-actions { gap: 7px; }
  .customer-header-actions button, .balance-chip { font-size: 12px; padding: 7px 9px; }
  .customer-nav { padding: 0 10px; overflow-x: auto; }
  nav { min-width: max-content; height: 54px; }
  nav button { min-width: 88px; padding: 9px 12px; }
  .notice-board { padding: 18px 16px; min-height: auto; }
  .notice-copy strong { font-size: 20px; }
  .notice-copy p { font-size: 17px; }
  .summary-grid, .machine-grid, .recharge-grid, .rank-layout, .admin-grid { grid-template-columns: 1fr; }
  .panel-head { grid-template-columns: 1fr; }
  .panel-actions { justify-self: start; }
  .refresh-inline { justify-self: start; }
  .card-form, .admin-device-form { display: grid; grid-template-columns: 1fr; }
  .admin-balance-form { grid-template-columns: 1fr; }
}
