/* SWYC admin console.
 *
 * The markup was written against a stylesheet that only overrode colours, so the
 * console rendered as raw HTML: a sidebar that stacked above the content, tables
 * with no borders, a login form with no card. This file carries the layout that
 * was missing, keeping the neutral light palette of the earlier colour rules.
 */

:root {
  --surface: #ffffff;
  --page: #f5f7fa;
  --ink: #1f2937;
  --muted: #7b8491;
  --line: #e3e8ef;
  --accent: #245a9c;
  --accent-soft: #eaf1fa;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .05);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

/* The page toggles sections with the `hidden` attribute. Any author rule that sets
 * `display` (the login card is a grid, the dashboard a block) beats the user-agent
 * `[hidden] { display: none }`, so without this a logged-in console still showed the
 * login card. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 14px/1.55 "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---------- sidebar ---------- */

aside {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: inherit; }

.brand > span {
  width: 36px; height: 36px; border-radius: 11px;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center;
  font-weight: 700; font-size: 17px; flex: none;
}

.brand div { display: flex; flex-direction: column; font-weight: 600; font-size: 14px; }
.brand small {
  color: var(--muted); font-weight: 500; font-size: 9.5px;
  letter-spacing: .12em; text-transform: uppercase; margin-top: 2px;
}

.nav-label {
  color: var(--muted); font-size: 10.5px;
  letter-spacing: .14em; text-transform: uppercase; margin-bottom: -16px;
}

nav { display: flex; flex-direction: column; gap: 4px; }

nav button {
  appearance: none; border: 0; background: transparent; color: #6b7280;
  text-align: left; padding: 9px 12px; border-radius: 9px;
  font: inherit; cursor: pointer; transition: background .15s, color .15s;
}

nav button:hover { background: var(--page); color: var(--ink); }
nav button.selected { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.aside-bottom {
  margin-top: auto; display: flex; align-items: center; gap: 8px;
  color: #52637a; font-size: 12px; padding-top: 16px; border-top: 1px solid var(--line);
}

.aside-bottom small { color: var(--muted); font-size: 11px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #4c7bb5; flex: none; }

/* ---------- main ---------- */

main {
  padding: 28px 34px 40px;
  display: flex; flex-direction: column; gap: 22px; min-width: 0;
}

header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
}

header h1 { font-size: 28px; line-height: 1.25; margin: 4px 0 6px; letter-spacing: -.02em; }

.eyebrow {
  color: #71809a; font-size: 10.5px; letter-spacing: .16em;
  text-transform: uppercase; margin: 0;
}

.muted { color: var(--muted); margin: 0; font-size: 13px; }
.header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#admin-email { color: var(--muted); font-size: 12px; margin-right: 4px; }

/* ---------- controls ---------- */

button {
  font: inherit; border-radius: 9px; border: 1px solid transparent;
  background: var(--accent); color: #fff; padding: 9px 16px;
  cursor: pointer; transition: filter .15s, background .15s, color .15s;
}

button:hover { filter: brightness(1.06); }
button:disabled { opacity: .55; cursor: not-allowed; filter: none; }

button.secondary { background: #f5f7fa; color: var(--accent); border-color: #dfe5ee; }
button.secondary:hover { background: var(--accent-soft); }

button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid #8db3e0; outline-offset: 1px;
}

label { color: #536176; font-size: 12px; display: flex; flex-direction: column; gap: 5px; }

input, select {
  font: inherit; color: var(--ink); background: #fff;
  border: 1px solid #dfe5ee; border-radius: 9px; padding: 9px 11px; min-width: 0;
}

input[type="checkbox"] { width: auto; padding: 0; }

/* ---------- message ---------- */

#message, #account-message { color: var(--accent); margin: 0; font-size: 13px; }
#message:empty, #account-message:empty { display: none; }
#message:not(:empty), #account-message:not(:empty) {
  background: var(--accent-soft); border-radius: 10px; padding: 10px 14px;
}

/* ---------- login ---------- */

.login-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  max-width: 780px;
}

.login-art {
  background: #f5f7fa; padding: 30px 26px;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 10px;
  position: relative; overflow: hidden; min-height: 240px;
}

.login-art p { margin: 0; font-size: 19px; line-height: 1.4; font-weight: 600; position: relative; }
.login-art small { color: var(--muted); font-size: 11.5px; position: relative; }

.rings {
  position: absolute; width: 190px; height: 190px; border-radius: 50%;
  border: 1px solid #cbd8e855; top: -56px; right: -50px;
  box-shadow: 0 0 0 24px #eaf1fa70, inset 14px -10px 25px #9eb4d025;
}

.login-card form { padding: 28px 30px; display: flex; flex-direction: column; gap: 14px; }
.login-card h2 { margin: 0; font-size: 20px; }
.login-card button { margin-top: 4px; }
.hint { color: var(--muted); font-size: 11.5px; margin: 0; }

/* ---------- metrics ---------- */

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }

.metrics article {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px;
  display: flex; flex-direction: column; gap: 4px;
}

.metrics span { color: var(--muted); font-size: 12px; }
.metrics b { font-size: 24px; font-weight: 650; letter-spacing: -.01em; }
.metrics small { color: var(--muted); font-size: 11px; }
.metrics .status-value { color: var(--accent); font-size: 18px; }

/* ---------- panels ---------- */

.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px 6px; box-shadow: var(--shadow);
}

.panel-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 12px;
}

.panel-head h2 { margin: 0 0 4px; font-size: 16px; }
.search { flex-direction: row; align-items: center; gap: 8px; font-size: 12px; }
.search input { width: 190px; }

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }

th {
  text-align: left; font-weight: 600; font-size: 11.5px;
  letter-spacing: .06em; text-transform: uppercase; color: #71809a;
  background: #fafbfc; padding: 9px 12px;
  border-bottom: 1px solid #edf0f4; white-space: nowrap;
}

td { padding: 11px 12px; border-bottom: 1px solid #edf0f4; vertical-align: middle; }
tbody tr:hover { background: #fafcff; }
tbody tr:last-child td { border-bottom: 0; }
td small { color: #87909c; display: block; font-size: 11.5px; }

.badge {
  display: inline-block; background: var(--accent-soft); color: var(--accent);
  border-radius: 999px; padding: 2px 9px; font-size: 11.5px; font-weight: 600;
}

.empty { color: var(--muted); padding: 16px 0 20px; margin: 0; font-size: 13px; }

/* ---------- account data ---------- */

.data-view { min-width: 0; }
.data-view .panel-head { margin-bottom: 14px; }
.data-view .panel-head h2 { margin: 0 0 4px; font-size: 17px; }
.portfolio-totals {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: #fff; margin: 0 0 12px;
}
.portfolio-totals > div { padding: 12px 14px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.portfolio-totals > div:last-child { border-right: 0; }
.portfolio-totals span, .detail-topline span, .detail-metrics span { color: #687588; font-size: 11px; }
.portfolio-totals b { font-size: 19px; font-weight: 650; }
.portfolio-totals small { color: var(--muted); font-size: 10.5px; overflow-wrap: anywhere; }
.portfolio-table-wrap { margin: 0; padding: 0; border: 1px solid var(--line); background: #fff; }
.portfolio-table { min-width: 1240px; font-size: 12px; }
.portfolio-table th { font-size: 10.5px; padding: 9px 10px; }
.portfolio-table td { padding: 9px 10px; vertical-align: top; }
.portfolio-table .account-cell { min-width: 170px; max-width: 210px; }
.portfolio-table .account-cell small { overflow-wrap: anywhere; }
.account-link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 650; text-align: left; overflow-wrap: anywhere; }
.account-link:hover { text-decoration: underline; filter: none; }
.portfolio-table .mode-cell { min-width: 130px; }
.mode-cell > span { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; white-space: nowrap; }
.badge.running { background: #e6f5ef; color: #207a59; }
.badge.off { background: #f1f3f6; color: #6b7582; }
.badge.warning { background: #fff1df; color: #92542a; }
.portfolio-table .amount-cell { min-width: 155px; white-space: nowrap; }
.amount-cell b { font-weight: 650; font-variant-numeric: tabular-nums; }
.position-list { display: flex; flex-direction: column; gap: 3px; max-height: 120px; overflow-y: auto; min-width: 130px; }
.position-line { white-space: nowrap; font-variant-numeric: tabular-nums; }
.unknown { color: #8c96a3; font-weight: 400; }
.detail-button { padding: 5px 9px; white-space: nowrap; font-size: 11.5px; }
.loading-cell { text-align: center; color: var(--muted); padding: 25px !important; }
.portfolio-updated { color: var(--muted); font-size: 11px; margin: 8px 0 0; }

.portfolio-dialog { width: min(1180px, calc(100vw - 24px)); max-width: none; max-height: calc(100vh - 24px); border-radius: 8px; }
.portfolio-dialog .dialog-head { padding: 14px 20px; }
.portfolio-dialog .dialog-head h2 { font-size: 18px; }
.portfolio-dialog #portfolio-subtitle { margin: 2px 0 0; overflow-wrap: anywhere; }
.portfolio-detail { padding: 0 20px 20px; margin: 0 !important; }
.detail-topline {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line); margin-bottom: 16px;
}
.detail-topline > div { padding: 12px 4px; display: flex; flex-direction: column; min-width: 0; }
.detail-topline b { font-size: 18px; font-variant-numeric: tabular-nums; }
.mode-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.mode-detail { min-width: 0; }
.mode-detail + .mode-detail { border-left: 1px solid var(--line); padding-left: 22px; }
.mode-detail-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.mode-detail-head h3 { font-size: 15px; margin: 0; }
.detail-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.detail-metrics > div { display: flex; flex-direction: column; min-width: 0; }
.detail-metrics b { font-size: 17px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.detail-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; margin: 0 0 16px; font-size: 12px; }
.detail-facts div { display: flex; justify-content: space-between; gap: 6px; border-bottom: 1px solid #eef1f5; padding-bottom: 5px; min-width: 0; }
.detail-facts dt { color: var(--muted); white-space: nowrap; }
.detail-facts dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.data-section { margin-top: 16px; min-width: 0; }
.data-section h4 { font-size: 12.5px; margin: 0 0 6px; }
.data-section .hint { margin: -3px 0 6px; }
.data-section .table-wrap { margin: 0; padding: 0; border: 1px solid var(--line); }
.data-section table { min-width: 620px; font-size: 11.5px; }
.data-section td, .data-section th { padding: 6px 8px; }
.data-section p.unknown { padding: 8px 0; margin: 0; font-size: 12px; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-heading h4 { margin-bottom: 6px; }
.history-section .trade-history-table { min-width: 1100px; }
.trade-history-table td, .trade-history-table th { white-space: nowrap; }
.trade-history-table td:last-child { min-width: 128px; white-space: normal; overflow-wrap: anywhere; }
.trade-history-table td small { font-size: 10px; }
.history-pager { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.history-pager button { padding: 5px 10px; font-size: 11.5px; }
.data-warning { color: #9a532f; background: #fff5eb; padding: 7px 9px; font-size: 11.5px; overflow-wrap: anywhere; }
.detail-actions { display: flex; justify-content: flex-end; border-top: 1px solid var(--line); margin-top: 20px; padding-top: 14px; }

/* ---------- forms in panels ---------- */

.form-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px; margin-bottom: 12px;
}

.switches { display: flex; gap: 18px; margin-bottom: 12px; flex-wrap: wrap; }
.switches label { flex-direction: row; align-items: center; gap: 7px; font-size: 13px; color: var(--ink); }
.switches input { accent-color: var(--accent); }

.check-line {
  flex-direction: row; align-items: center; gap: 8px;
  font-size: 13px; color: var(--ink); margin-bottom: 12px;
}

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 14px; }

/* ---------- dialog ---------- */

dialog {
  border: 1px solid #dfe5ee; border-radius: 16px; color: var(--ink);
  padding: 0; width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  box-shadow: 0 24px 64px rgba(16, 24, 40, .18);
}

dialog::backdrop { background: rgba(16, 24, 40, .35); }
dialog > *:not(.dialog-head) { margin-left: 22px; margin-right: 22px; }

.dialog-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 22px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}

.dialog-head h2 { margin: 2px 0 0; font-size: 17px; }

dialog h3 { font-size: 14px; margin: 22px 0 10px; }
dialog form { margin-bottom: 6px; }
dialog .table-wrap { margin: 0 0 6px; padding: 0; }

/* ---------- footer ---------- */

footer {
  margin-top: auto; padding-top: 16px; border-top: 1px solid #e2e7ef;
  color: var(--muted); font-size: 11.5px; display: flex; gap: 10px; flex-wrap: wrap;
}

footer span { color: #a2abb8; }

/* ---------- narrow screens ---------- */

@media (max-width: 900px) {
  body { grid-template-columns: 1fr; }
  aside {
    position: static; height: auto; border-right: 0;
    border-bottom: 1px solid var(--line); flex-direction: row;
    align-items: center; gap: 16px; padding: 14px 16px; overflow-x: auto;
  }
  .brand small, .nav-label, .aside-bottom { display: none; }
  nav { flex-direction: row; gap: 6px; }
  nav button { white-space: nowrap; }
  main { padding: 20px 16px 32px; }
  header h1 { font-size: 22px; }
  .login-card { grid-template-columns: 1fr; }
  .login-art { min-height: 150px; }
  .table-wrap { margin: 0 -14px; padding: 0 14px; }
  dialog .table-wrap { margin: 0; padding: 0; }
  .portfolio-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portfolio-totals > div:nth-child(2) { border-right: 0; }
  .portfolio-totals > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .portfolio-totals > div:nth-child(3) { border-right: 0; }
  .mode-details { grid-template-columns: 1fr; }
  .mode-detail + .mode-detail { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; padding-top: 18px; }
}

@media (max-width: 520px) {
  .portfolio-dialog { width: calc(100vw - 12px); max-height: calc(100vh - 12px); }
  .portfolio-detail { padding: 0 12px 16px; }
  .detail-topline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-topline > div { padding: 8px 4px; }
  .detail-facts { grid-template-columns: 1fr; }
  .portfolio-dialog .dialog-head { padding: 10px 12px; }
}

/* Shared visual system for the account inspector and the remaining admin views. */
:root {
  --page: #f7f9fa;
  --ink: #202b30;
  --muted: #73818a;
  --line: #e5eaec;
  --accent: #168363;
  --accent-soft: #e7f5ee;
  --radius: 6px;
  --shadow: 0 1px 5px rgba(30, 47, 55, .03);
}

body { grid-template-columns: 172px minmax(0, 1fr); }
aside { padding: 20px 12px; gap: 26px; }
.brand { gap: 9px; padding: 0 7px; }
.brand > .brand-mark, .login-logo {
  width: 32px; height: 32px; border-radius: 7px; background: #29aa7f;
  color: #fff; font-size: 18px; font-weight: 750; display: grid; place-items: center;
}
.brand div { font-size: 13px; white-space: nowrap; }
.brand small { font-size: 8px; letter-spacing: 0; }
.nav-label { letter-spacing: 0; padding: 0 12px; }
nav button { border-radius: 5px; color: #52626a; padding: 10px 12px; }
nav button.selected { background: var(--accent-soft); }
.aside-bottom { padding: 16px 7px 0; }
.aside-bottom span:last-child { display: flex; flex-direction: column; }
.aside-bottom small { display: block; }
.dot { background: #28a779; }

main { padding: 22px 24px 30px; gap: 17px; }
header { align-items: center; }
header h1 { font-size: 22px; margin: 2px 0; letter-spacing: 0; }
.eyebrow { color: #7b8a90; letter-spacing: 0; font-size: 10px; }
.muted { font-size: 12px; }
#admin-email { font-size: 12px; }
button { border-radius: 5px; padding: 8px 12px; }
button.secondary { background: #fff; border-color: #dbe3e5; color: #4e626b; }
button.secondary:hover { background: #f4f8f6; }
input, select { border-radius: 5px; border-color: #dbe3e5; }
button:focus-visible, input:focus-visible, select:focus-visible { outline-color: #5bbb99; }

.metrics { gap: 0; border: 1px solid var(--line); background: #fff; border-radius: var(--radius); }
.metrics[hidden] { display: none !important; }
.metrics article { border: 0; border-right: 1px solid var(--line); border-radius: 0; padding: 12px 18px; box-shadow: none; gap: 1px; }
.metrics article:last-child { border-right: 0; }
.metrics b { font-size: 21px; letter-spacing: 0; }
.metrics .status-value { font-size: 16px; }

.data-view { min-width: 0; }
.portfolio-totals { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; }
.portfolio-totals > div { padding: 10px 17px; }
.portfolio-totals b { font-size: 18px; letter-spacing: 0; }
.service-line { color: #63746d; font-size: 11px; margin: -5px 1px 10px; }
.service-line::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #2ca47d; margin-right: 7px; }
.service-line.offline::before { background: #be6d4d; }
.portfolio-split { display: grid; grid-template-columns: minmax(390px, 39%) minmax(0, 1fr); gap: 12px; align-items: stretch; min-height: 660px; }
.portfolio-master, .portfolio-inspector { min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.portfolio-master { display: flex; flex-direction: column; overflow: hidden; }
.portfolio-master .panel-head { margin: 0; padding: 17px 18px 9px; }
.portfolio-master .panel-head h2 { font-size: 17px; margin: 0 0 2px; }
.portfolio-search { display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 0 18px 15px; color: var(--muted); }
.portfolio-search input { width: 100%; height: 36px; }
.balance-list-hint { color: var(--muted); font-size: 11px; margin: -5px 18px 10px; }
.portfolio-list-heading, .portfolio-user { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(80px, .75fr) minmax(70px, .75fr) minmax(70px, .75fr); gap: 6px; align-items: center; }
.portfolio-list-heading { padding: 8px 14px; background: #f7f9fa; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: #70808a; font-size: 11px; }
.portfolio-list-heading span:nth-child(n+3) { text-align: right; }
.portfolio-list { flex: 1; max-height: 720px; overflow-y: auto; }
.portfolio-user { width: 100%; padding: 12px 14px; background: #fff; color: var(--ink); border: 0; border-bottom: 1px solid #edf0f1; border-radius: 0; text-align: left; cursor: pointer; font-size: 11.5px; }
.portfolio-user:hover { background: #f4faf7; filter: none; }
.portfolio-user.selected { background: #eaf7f1; }
.portfolio-user-identity { display: flex; min-width: 0; align-items: center; gap: 8px; }
.user-avatar { flex: none; width: 31px; height: 31px; display: grid; place-items: center; border-radius: 50%; background: #e7ecee; color: #788a91; font-size: 12px; font-weight: 700; }
.portfolio-user.selected .user-avatar { background: #d4efe2; color: #127658; }
.user-name { display: flex; min-width: 0; flex-direction: column; }
.user-name b, .user-name small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-name b { font-size: 12px; font-weight: 650; }
.user-name small { color: #87939a; font-size: 10.5px; }
.user-name .badge { align-self: flex-start; margin-top: 3px; }
.user-status { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 3px 4px; }
.status-label { color: #819099; font-size: 10px; }
.badge { border-radius: 4px; padding: 2px 6px; }
.user-status .badge { width: fit-content; font-size: 10px; }
.user-money { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.user-money { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.user-money small { display: block; overflow: hidden; text-overflow: ellipsis; color: #96a1a7; font-size: 10px; font-weight: 400; }
.user-money .pnl-positive, .detail-metrics .pnl-positive { color: #177b57; }
.user-money .pnl-negative, .detail-metrics .pnl-negative { color: #b34f4f; }
.balance-failed { color: #ad6544; }
.portfolio-master .empty { padding: 18px; }
.loading-cell { text-align: center; margin: 0; }

.portfolio-inspector { overflow: hidden; }
.inspector-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 20px 22px 16px; }
.inspector-head h2 { font-size: 20px; margin: 2px 0 3px; overflow-wrap: anywhere; }
.inspector-head .muted { overflow-wrap: anywhere; }
#close-portfolio { display: none; }
.portfolio-tabs { display: flex; border-bottom: 1px solid var(--line); padding: 0 22px; gap: 24px; }
.portfolio-tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: #607179; padding: 10px 2px; font-weight: 600; }
.portfolio-tabs button.selected { color: var(--accent); border-bottom-color: #2db184; }
.portfolio-detail { padding: 0 22px 24px; margin: 0; }
.detail-topline { margin: 0 0 16px; grid-template-columns: repeat(4, minmax(0,1fr)); }
.detail-topline > div { padding: 14px 5px; }
.detail-topline b { font-size: 17px; }
.mode-detail-head { padding: 0 0 10px; }
.mode-detail-head h3 { font-size: 14px; }
.detail-metrics { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; border-bottom: 1px solid var(--line); margin: 0 0 12px; }
.detail-metrics > div { padding: 15px 6px 16px; }
.detail-metrics b { font-size: 19px; }
.balance-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; color: var(--muted); font-size: 11px; }
.balance-controls span { overflow-wrap: anywhere; }
.balance-controls button { white-space: nowrap; flex: none; padding: 5px 9px; font-size: 11px; }
.detail-facts { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 7px 17px; }
.detail-facts div { font-size: 11.5px; }
.detail-facts dt { white-space: normal; }
.data-section { margin-top: 16px; }
.data-section h4 { font-size: 13px; }
.data-section .table-wrap { border-radius: 5px; }
.data-section table { min-width: 620px; }
.data-section th { background: #f7f9fa; }
.detail-actions { margin-top: 20px; }
.portfolio-updated { margin: 8px 1px 0; }

.panel { padding: 20px 22px 12px; border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-head h2 { font-size: 17px; }
.panel .table-wrap { margin: 0 -22px; padding: 0 22px; }
th { background: #f7f9fa; letter-spacing: 0; text-transform: none; color: #6b7a82; }
td { font-variant-numeric: tabular-nums; }
#users-body button { white-space: nowrap; }
#smtp-form { max-width: 790px; padding: 8px 0 20px; }
#smtp-form .form-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px 20px; }
#smtp-form label { font-size: 12px; }
#smtp-form input, #smtp-form select { min-height: 38px; }

.login-card { max-width: 760px; width: 100%; margin: 7vh auto 0; grid-template-columns: minmax(0, 270px) minmax(0, 1fr); border-radius: var(--radius); }
.login-art { background: #ebf6f0; justify-content: center; align-items: flex-start; padding: 30px; min-height: 370px; }
.login-art p { font-size: 20px; color: #174c3b; }
.login-art small { color: #59796b; }
.login-logo { width: 50px; height: 50px; font-size: 26px; margin-bottom: 15px; }
.login-card form { justify-content: center; padding: 35px 40px; }
.login-card h2 { font-size: 21px; }
.rings { display: none; }

dialog { border-radius: 8px; width: min(920px, calc(100vw - 32px)); }
.dialog-head { padding: 15px 22px; }
footer { border-color: var(--line); }

@media (max-width: 1200px) {
  .portfolio-split { grid-template-columns: minmax(340px, 38%) minmax(0, 1fr); }
  .portfolio-list-heading, .portfolio-user { grid-template-columns: minmax(0, 1.4fr) minmax(70px, .8fr) minmax(62px, .75fr); }
  .portfolio-list-heading span:last-child, .portfolio-user > .user-money:last-child { display: none; }
}

@media (max-width: 900px) {
  body { grid-template-columns: 1fr; }
  aside { padding: 10px 16px; }
  .brand small, .nav-label, .aside-bottom { display: none; }
  .portfolio-split { grid-template-columns: 1fr; min-height: 0; }
  .portfolio-master { min-height: 300px; }
  .portfolio-list { max-height: 400px; }
  .portfolio-list-heading, .portfolio-user { grid-template-columns: minmax(0, 1.7fr) minmax(78px, .8fr) minmax(80px, .75fr) minmax(80px, .75fr); }
  .portfolio-list-heading span:last-child, .portfolio-user > .user-money:last-child { display: block; }
  .portfolio-inspector { min-height: 370px; }
  #close-portfolio { display: inline-block; }
}

@media (max-width: 620px) {
  main { padding: 16px 12px 24px; }
  header { align-items: flex-start; }
  .header-actions { width: 100%; justify-content: flex-end; }
  .metrics, .portfolio-totals { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .metrics article:nth-child(2), .portfolio-totals > div:nth-child(2) { border-right: 0; }
  .metrics article:nth-child(-n+2), .portfolio-totals > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .portfolio-totals b { font-size: 16px; }
  .portfolio-list-heading, .portfolio-user { grid-template-columns: minmax(0, 1.5fr) minmax(76px, .75fr) minmax(74px, .75fr); }
  .portfolio-list-heading span:nth-child(3), .portfolio-user > .user-money:nth-child(3) { display: none; }
  .inspector-head { padding: 16px 14px; }
  .portfolio-tabs { padding: 0 14px; }
  .portfolio-detail { padding: 0 14px 18px; }
  .detail-topline { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .detail-facts { grid-template-columns: 1fr; }
  #smtp-form .form-grid { grid-template-columns: 1fr; }
  .login-card { margin: 20px auto 0; grid-template-columns: 1fr; }
  .login-art { min-height: 125px; padding: 18px 24px; }
  .login-logo { width: 34px; height: 34px; font-size: 18px; margin: 0; }
  .login-art p { font-size: 16px; }
  .login-card form { padding: 24px; }
}

.user-split, .audit-split, .smtp-split { display: grid; grid-template-columns: minmax(330px, 38%) minmax(0, 1fr); gap: 12px; align-items: stretch; min-height: 680px; }
.user-master, .user-inspector, .audit-master, .audit-inspector, .smtp-master, .smtp-inspector { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; box-shadow: var(--shadow); }
.user-master, .audit-master { display: flex; flex-direction: column; overflow: hidden; }
.user-master .panel-head, .audit-master .panel-head, .smtp-master .panel-head { padding: 17px 18px 9px; margin: 0; }
.user-master .panel-head h2, .audit-master .panel-head h2, .smtp-master .panel-head h2 { margin: 0 0 2px; font-size: 17px; }
.user-list-heading, .user-row { display: grid; grid-template-columns: minmax(0, 1.6fr) 70px minmax(78px,.7fr); gap: 8px; align-items: center; }
.user-list-heading, .audit-list-heading { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #f7f9fa; color: #70808a; font-size: 11px; padding: 8px 14px; }
.user-list-heading span:last-child, .user-created { text-align: right; }
.user-list, .audit-list { overflow-y: auto; max-height: 720px; flex: 1; }
.user-row, .audit-row { border: 0; border-bottom: 1px solid #edf0f1; border-radius: 0; background: #fff; width: 100%; color: var(--ink); text-align: left; padding: 11px 14px; }
.user-row:hover, .audit-row:hover { background: #f4faf7; filter: none; }
.user-row.selected, .audit-row.selected { background: #eaf7f1; }
.user-row .badge { width: fit-content; }
.user-created { color: var(--muted); font-size: 10px; white-space: nowrap; }
.user-inspector > .empty { padding: 26px 22px; }
#account-dialog {
  position: static; display: none; width: 100%; max-width: none; max-height: none;
  margin: 0; border: 0; border-radius: 0; box-shadow: none; overflow: visible;
}
#account-dialog[open] { display: block; }
#account-dialog .dialog-head { padding: 20px 22px 16px; }
#account-dialog .dialog-head h2 { font-size: 18px; overflow-wrap: anywhere; }
#account-dialog #close-dialog { flex: none; min-width: 84px; white-space: nowrap; }
#account-dialog > *:not(.dialog-head) { margin-left: 22px; margin-right: 22px; }
#account-dialog #account-message { margin-top: 12px; }
.account-tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--line); }
.account-tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: #607179; padding: 12px 2px; font-weight: 600; }
.account-tabs button.selected { color: var(--accent); border-bottom-color: #2db184; }
.account-tab-content { padding-bottom: 20px; }
.account-tab-content h3 { margin: 20px 0 10px; font-size: 14px; }
.account-tab-content .hint { margin: 5px 0; }
.account-tab-content .table-wrap { overflow-x: auto; }
.account-tab-content table { min-width: 480px; }
#points-balance { font-size: 14px; color: #304b40; font-weight: 650; }
#account-tab-security form { max-width: 460px; }
#account-tab-security form label { margin-bottom: 10px; }

.audit-list-heading, .audit-row { display: grid; grid-template-columns: 116px minmax(0,1fr); gap: 12px; }
.audit-row { font-size: 11.5px; align-items: start; }
.audit-row span:first-child { color: #75838a; font-variant-numeric: tabular-nums; }
.audit-row b, .audit-row small { display: block; overflow-wrap: anywhere; }
.audit-row small { color: #86939a; font-size: 10.5px; margin-top: 2px; }
.audit-inspector .inspector-head { border-bottom: 1px solid var(--line); }
.audit-detail { padding: 4px 22px 24px; }
.audit-facts { margin: 0; }
.audit-facts div { display: grid; grid-template-columns: 125px minmax(0,1fr); gap: 18px; padding: 16px 0; border-bottom: 1px solid #edf0f1; }
.audit-facts dt { color: #70808a; }
.audit-facts dd { margin: 0; overflow-wrap: anywhere; }

.smtp-menu-item { background: var(--accent-soft); color: var(--accent); font-weight: 650; margin: 10px 14px; padding: 13px 14px; border-radius: 5px; }
.smtp-inspector .inspector-head { border-bottom: 1px solid var(--line); }
.smtp-inspector #smtp-form { padding: 20px 22px; max-width: none; }
.smtp-inspector #smtp-form .form-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.smtp-inspector .check-line { margin-top: 16px; }
.smtp-inspector #smtp-message:not(:empty) { background: var(--accent-soft); color: var(--accent); padding: 10px 12px; margin-top: 14px; border-radius: 5px; }
.smtp-inspector #smtp-message.error { color: #a84a3c; background: #fff1ee; }

@media (max-width: 1100px) {
  .user-split, .audit-split, .smtp-split { grid-template-columns: minmax(280px, 36%) minmax(0, 1fr); }
  .user-list-heading, .user-row { grid-template-columns: minmax(0,1fr) 66px; }
  .user-list-heading span:last-child, .user-created { display: none; }
}

@media (max-width: 900px) {
  .user-split, .audit-split, .smtp-split { grid-template-columns: 1fr; min-height: 0; }
  .user-list, .audit-list { max-height: 350px; }
  .user-list-heading, .user-row { grid-template-columns: minmax(0,1.6fr) 80px minmax(0,.6fr); }
  .user-list-heading span:last-child, .user-created { display: block; }
  .smtp-master { min-height: 90px; }
}

@media (max-width: 620px) {
  .user-list-heading, .user-row { grid-template-columns: minmax(0,1fr) 70px; }
  .user-list-heading span:last-child, .user-created { display: none; }
  #account-dialog .dialog-head { padding: 15px 14px; }
  #account-dialog > *:not(.dialog-head) { margin-left: 14px; margin-right: 14px; }
  .account-tabs { gap: 13px; }
  .account-tabs button { white-space: nowrap; font-size: 12px; }
  #account-dialog #close-dialog { min-width: 92px; }
  .audit-facts div { grid-template-columns: 95px minmax(0,1fr); gap: 8px; }
  .smtp-inspector #smtp-form .form-grid { grid-template-columns: 1fr; }
}
