
:root {
  --bg: #e9e9e9;
  --panel: #efefef;
  --line: #8d8d8d;
  --text: #111;
  --muted: #666;
  --blue: #0000cc;
  --red: #d40000;
  --green: #008000;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: SimSun, "Microsoft YaHei UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}
button, input, textarea, select {
  font-family: inherit;
}
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #dcdcdc;
}
.login-box {
  width: 420px;
  border: 1px solid #8f8f8f;
  background: #efefef;
  padding: 20px 22px;
}
.login-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 16px;
}
.field { margin-bottom: 10px; }
.field label {
  display: block;
  font-weight: 700;
  margin-bottom: 4px;
}
.field input, .field select, textarea {
  width: 100%;
  border: 1px solid #888;
  background: white;
  padding: 6px;
  font-size: 16px;
}
.hint { color: var(--muted); line-height: 1.55; font-size: 13px; }
.error { color: var(--red); font-weight: 700; margin-top: 8px; }
.topbar {
  height: 54px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  background: #f4f4e9;
  padding: 4px 8px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar button, .primary, .plain-btn {
  background: #d8d8d8;
  border: 1px solid #777;
  min-height: 34px;
  padding: 4px 14px;
  font-size: 17px;
  font-weight: 700;
  box-shadow: inset 1px 1px #fff, inset -1px -1px #999;
  cursor: pointer;
}
.primary { color: var(--blue); }
.top-title {
  font-size: 18px;
  font-weight: 700;
  margin-right: 10px;
}
.spacer { flex: 1; }
.role-tag {
  color: var(--red);
  font-weight: 700;
  margin-right: 8px;
}
.mobile-tabs {
  display: none;
}
.layout {
  height: calc(100vh - 54px);
  display: grid;
  grid-template-columns: minmax(520px, 1.1fr) 390px 380px;
  gap: 0;
}
.pane {
  border-right: 1px solid var(--line);
  background: var(--panel);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.pane:last-child { border-right: 0; }
.pane-head {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  font-size: 16px;
}
.summary-line {
  display: flex;
  gap: 24px;
  padding: 7px 8px;
  border-bottom: 1px solid #c0c0c0;
  font-weight: 700;
}
.work-area {
  display: grid;
  grid-template-rows: 210px auto 1fr 1.1fr;
  min-height: 0;
  flex: 1;
}
textarea {
  resize: none;
  height: 100%;
  font-size: 15px;
  line-height: 1.45;
}
.textarea-wrap, .result-wrap, .table-wrap {
  padding: 6px;
  min-height: 0;
}
.result-wrap {
  border-top: 1px solid var(--line);
  overflow: auto;
}
.detail-wrap {
  border-top: 1px solid var(--line);
  overflow: auto;
  min-height: 0;
}
.actions {
  padding: 6px;
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--line);
}
table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}
th, td {
  border: 1px solid #c8c8c8;
  padding: 3px 6px;
  font-size: 14px;
}
th {
  background: #dddddd;
  font-weight: 700;
}
.ok-row td { color: #111; }
.bad-row td { color: var(--red); font-weight: 700; }
.center-pane {
  padding: 8px;
  gap: 8px;
}
.section {
  border: 1px solid #aaa;
  background: #efefef;
  padding: 8px;
}
.section-title {
  color: var(--blue);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}
.account-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.account-form button { grid-column: 1 / -1; }
.self-form {
  margin-top: 8px;
}
.account-table {
  table-layout: fixed;
}
.account-table th, .account-table td {
  padding: 3px 4px;
}
.account-table input {
  width: 100%;
  min-width: 0;
  border: 1px solid #aaa;
  padding: 4px;
  font-size: 13px;
}
.account-table .password-cell {
  min-width: 0;
}
.password-cell input {
  margin-bottom: 4px;
}
.save-managed-account {
  width: 100%;
  min-height: 26px;
  padding: 2px 4px;
  color: var(--blue);
}
.account-message {
  margin-top: 6px;
  min-height: 18px;
  color: var(--red);
  font-weight: 700;
}
.orders {
  min-height: 0;
  overflow: auto;
}
.orders-tools {
  display: flex;
  justify-content: flex-end;
  padding-top: 6px;
}
.risk-table-wrap {
  flex: 1;
  overflow: hidden;
  padding: 0 4px 4px;
}
.risk-table th, .risk-table td {
  font-size: 14px;
  font-weight: 700;
  padding: 2px 4px;
}
.num-red { color: #f00; }
.num-green { color: #008000; }
.num-blue { color: #00f; }
.special-table td { font-weight: 700; }
.footer-note {
  padding: 5px 8px;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid #bbb;
}
@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  .pane {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow: visible;
  }
  .risk-table-wrap {
    overflow-x: auto;
  }
}
@media (max-width: 760px), (pointer: coarse) {
  body {
    background: #f2f2f2;
    padding-bottom: 60px;
  }
  .login {
    align-items: start;
    padding: 14px;
  }
  .login-box {
    width: 100%;
    margin-top: 28px;
    padding: 16px;
  }
  .topbar {
    height: 42px;
    flex-wrap: nowrap;
    gap: 6px;
    padding: 4px 6px;
  }
  .top-title {
    display: none;
  }
  .topbar .desktop-nav {
    display: none;
  }
  .spacer {
    display: none;
  }
  .topbar button#logoutBtn {
    flex: 0 0 58px;
    min-height: 32px;
    padding: 3px 6px;
    font-size: 13px;
  }
  .role-tag {
    flex: 1 1 auto;
    margin: 0;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .layout {
    display: block;
    height: auto;
  }
  .pane {
    margin: 6px;
    border: 1px solid #9b9b9b;
    display: block;
  }
  body[data-mobile-tab="order"] .center-pane,
  body[data-mobile-tab="order"] .summary-pane {
    display: none;
  }
  body[data-mobile-tab="accounts"] .order-pane,
  body[data-mobile-tab="accounts"] .summary-pane,
  body[data-mobile-tab="accounts"] .orders-section {
    display: none;
  }
  body[data-mobile-tab="orders"] .order-pane,
  body[data-mobile-tab="orders"] .summary-pane,
  body[data-mobile-tab="orders"] .account-section,
  body[data-mobile-tab="orders"] .account-list-section {
    display: none;
  }
  body[data-mobile-tab="summary"] .order-pane,
  body[data-mobile-tab="summary"] .center-pane {
    display: none;
  }
  .pane-head {
    font-size: 16px;
    padding: 7px 8px;
  }
  .summary-line {
    flex-wrap: wrap;
    gap: 10px;
    padding: 7px 8px;
    font-size: 15px;
  }
  .work-area {
    display: block;
  }
  .textarea-wrap {
    height: 38vh;
    min-height: 240px;
    padding: 8px;
  }
  textarea {
    font-size: 16px;
    line-height: 1.55;
  }
  .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    padding: 8px;
  }
  .actions button {
    min-height: 44px;
    font-size: 16px;
  }
  .result-wrap {
    max-height: 42vh;
    overflow: auto;
    padding: 8px;
  }
  .center-pane {
    padding: 8px;
  }
  .section {
    padding: 8px;
    margin-bottom: 8px;
  }
  .account-form {
    grid-template-columns: 1fr;
  }
  .table-wrap,
  .risk-table-wrap,
  .orders,
  .detail-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  table {
    min-width: 360px;
  }
  th, td {
    font-size: 13px;
    padding: 4px 5px;
  }
  .risk-table th, .risk-table td {
    font-size: 13px;
    padding: 3px 4px;
  }
  .footer-note {
    font-size: 12px;
  }
  .mobile-tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-top: 1px solid #777;
    background: #ededed;
  }
  .mobile-tabs button {
    min-height: 54px;
    border: 0;
    border-right: 1px solid #aaa;
    background: #dddddd;
    font-size: 15px;
    font-weight: 700;
    color: #111;
  }
  .mobile-tabs button:last-child {
    border-right: 0;
  }
  .mobile-tabs button.active {
    background: #f7f7f7;
    color: var(--blue);
    box-shadow: inset 0 3px var(--blue);
  }
}
