/* MT5 Cloud developer workspace — shared palette with site.css. */
:root {
  color-scheme: dark;
  --bg: #090a0d;
  --side: #0d0f13;
  --surface: #111318;
  --surface-2: #171a20;
  --card: var(--surface);
  --line: rgba(255, 255, 255, .1);
  --text: #f5f2eb;
  --muted: #a5a6ae;
  --gold: #d4a356;
  --gold-hover: #f0c982;
  --gold-soft: rgba(212, 163, 86, .12);
  --blue: var(--gold);
  --blue-soft: var(--gold-soft);
  --ok: #55d69b;
  --warn: #e7b74b;
  --bad: #e26c69;
  --shadow: 0 12px 36px rgba(0, 0, 0, .16);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", sans-serif;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 600; }
.auth {
  width: min(420px, calc(100% - 32px));
  margin: 10vh auto;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 32px;
}
.brand span { color: var(--blue); }
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side {
  background: var(--side);
  border-right: 1px solid var(--line);
  padding: 16px 12px 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}
.logo { display: flex; gap: 10px; align-items: center; padding: 6px 8px 16px; }
.logo-mark {
  width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--blue); color: var(--surface); font-weight: 700;
}
.logo strong { display: block; }
.logo small { color: var(--muted); }
.nav-label { margin: 14px 10px 6px; color: var(--muted); font-size: 12px; }
.nav-list { display: grid; gap: 2px; }
.nav-list button {
  display: flex; align-items: center; gap: 8px;
  text-align: left; border: 0; background: transparent;
  border-radius: 8px; padding: 9px 10px; cursor: pointer; color: var(--muted);
}
.nav-list button.active { background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.nav-ico { width: 16px; height: 16px; flex: none; }
.workspace { min-width: 0; }
.topbar {
  height: 56px; background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; position: sticky; top: 0; z-index: 5;
}
.crumb { color: var(--muted); }
.top-user { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--blue); color: var(--surface); font-size: 13px;
}
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding: 18px 20px 0; }
.hint, .muted { color: var(--muted); }
.err { color: var(--bad); min-height: 0; padding: 0 20px; }
.stats, .dash-grid { display: grid; gap: 16px; padding: 16px 20px 0; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.wallet-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding: 16px 20px 0; }
.wallet-summary .panel { margin: 0; }
.wallet-form { display: grid; gap: 8px; margin-top: 12px; }
.wallet-form label { display: grid; gap: 6px; color: var(--muted); }
.wallet-form input { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; }
.dash-grid { grid-template-columns: 1.4fr 0.8fr; }
.metric, .panel {
  background: var(--surface); border-radius: 8px; box-shadow: var(--shadow); padding: 16px 18px;
}
.metric { display: flex; justify-content: space-between; align-items: center; }
.metric span, .panel-title { color: var(--muted); }
.metric strong { display: block; margin-top: 8px; font-size: 28px; color: var(--text); }
.metric i { width: 8px; height: 36px; border-radius: 99px; }
.card {
  background: var(--surface); border-radius: 8px; box-shadow: var(--shadow);
  padding: 16px 18px; margin: 16px 20px 0;
}
.filters { padding: 0 20px; margin-top: 16px; }
.panel { margin: 16px 20px 0; }
.dash-grid .panel { margin: 0; }
.panel-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; color: var(--text); }
.panel-title h3 { font-size: 16px; }
.mix { display: flex; gap: 18px; align-items: center; }
.donut { width: 140px; height: 140px; transform: rotate(-90deg); }
.donut text { transform: rotate(90deg); transform-origin: 60px 60px; fill: var(--text); font-size: 12px; }
.donut text:first-of-type { font-size: 20px; font-weight: 650; }
.mix-legend { flex: 1; display: grid; gap: 10px; }
.mix-row { display: grid; grid-template-columns: 36px 1fr 28px; gap: 8px; align-items: center; color: var(--muted); }
.mix-row i { height: 8px; background: var(--surface-2); border-radius: 99px; display: block; }
.mix-row b { display: block; height: 8px; border-radius: 99px; }
.revenue { font-size: 28px; font-weight: 650; margin: 12px 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 0; }
.filters input, .filters select, .dialog input, .dialog select, .auth input {
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px;
}
.filters input { min-width: 220px; }
.card, .panel table { width: 100%; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12px; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.primary, .ghost, .danger, .text-btn {
  border-radius: 6px; border: 1px solid var(--line); background: var(--surface); padding: 7px 14px; cursor: pointer;
}
.primary { background: var(--blue); color: var(--surface); border-color: transparent; }
.danger { color: var(--bad); }
.text-btn { border: 0; color: var(--blue); background: transparent; padding: 0; }
.pill { display: inline-block; border-radius: 99px; padding: 1px 8px; font-size: 12px; background: var(--surface-2); }
.pill.ok { color: var(--ok); background: rgba(85, 214, 155, .1); }
.pill.warn { color: var(--warn); background: rgba(212, 163, 86, .12); }
.pill.bad { color: var(--bad); background: rgba(226, 108, 105, .12); }
.mask { position: fixed; inset: 0; background: rgba(29, 33, 41, 0.45); display: grid; place-items: center; padding: 20px; z-index: 20; }
.dialog { width: min(680px, 100%); background: var(--surface); border-radius: 8px; padding: 20px 22px; box-shadow: var(--shadow); }
.dialog .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
.check-row { display: flex !important; align-items: flex-start; gap: 10px !important; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }
.check-row input { margin-top: 4px; }
.check-row span { display: grid; gap: 2px; }
.check-row small { color: var(--muted); font-weight: 400; }
.equity-limits { display: grid; gap: 10px; margin: 12px 0; }
.equity-limits section { padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.equity-limits h3 { margin-bottom: 6px; font-size: 14px; }
.equity-limits .grid { gap: 4px 14px; }
.issue-validity { margin-top: 12px; padding: 12px; background: var(--surface-2); border-radius: 8px; }
.issue-validity > strong { display: block; margin-bottom: 8px; }
.issue-validity p { margin: 8px 0 0; color: var(--muted); }
.quick-cycles { display: flex; flex-wrap: wrap; gap: 8px; }
.quick-cycles button { border: 1px solid var(--line); border-radius: 99px; background: var(--surface); padding: 6px 14px; cursor: pointer; }
.quick-cycles button.active { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.tag-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tag-list span { border-radius: 99px; padding: 1px 7px; color: var(--blue); background: var(--blue-soft); font-size: 11px; }
.dialog label, .auth label { display: grid; gap: 6px; margin: 8px 0; color: var(--muted); }
.dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.key { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; background: var(--surface-2); padding: 12px; border-radius: 6px; }
pre { white-space: pre-wrap; background: var(--surface-2); padding: 14px; border-radius: 8px; }
.empty { color: var(--muted); padding: 28px 8px; text-align: center; }
.template-dialog { width: min(880px, 100%); max-height: min(90vh, 900px); overflow: auto; }
.template-fields { margin: 12px 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.template-fields > strong, .template-fields > small { display: block; margin-bottom: 8px; }
.template-fields > small { color: var(--muted); }
.template-fields .grid { max-height: 280px; overflow: auto; }
.product-key-cell { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.copy-icon { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 6px; padding: 4px 7px; font-size: 11px; cursor: pointer; white-space: nowrap; }
.copy-icon:hover { border-color: var(--gold); color: var(--text); background: var(--surface-2); }
.credential-stack { display: grid; gap: 7px; min-width: 260px; max-width: 360px; }
.credential-line { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto auto; align-items: center; gap: 6px; }
.credential-line small { color: var(--muted); font-size: 11px; }
.credential-line code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-size: 11px; }
.credential-note { color: var(--muted); font-size: 11px; }
.generated-product-key { display: grid; grid-template-columns: 80px 1fr auto; align-items: center; gap: 8px; margin: 10px 0 14px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.generated-product-key span { color: var(--muted); }
.generated-product-key small { grid-column: 2 / -1; color: var(--muted); }
.generated-product-key strong { color: var(--text); }
@media (max-width: 1100px) { .credential-stack { min-width: 220px; } .credential-line { grid-template-columns: 75px minmax(0, 1fr) auto auto; } }
.workspace > .panel:last-child, .workspace > .card { margin-bottom: 24px; }
@media (max-width: 980px) {
  .shell { display: block; }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav-groups { display: flex; gap: 12px; overflow: auto; }
  .nav-label { display: none; }
  .nav-list { display: flex; }
  .stats, .dash-grid { grid-template-columns: 1fr 1fr; }
  .wallet-summary { grid-template-columns: 1fr; }
  .dialog .grid { grid-template-columns: 1fr; }
}

.sdk-release { padding: 20px 0; border-top: 1px solid var(--line); }
.sdk-hash { display: block; overflow-wrap: anywhere; }

/* Workspace rhythm and interactive states. */
html { scrollbar-color: #444650 var(--side); }
body { background: radial-gradient(ellipse at 35% 0, rgba(212, 163, 86, .035), transparent 48%), var(--bg); }
::selection { background: rgba(212, 163, 86, .3); color: var(--text); }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { transition: border-color .15s, background .15s, box-shadow .15s; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 3px;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); }
input::placeholder, textarea::placeholder { color: #777a84; opacity: 1; }
input[type=checkbox], input[type=radio] { accent-color: var(--gold); }
input:disabled, select:disabled, textarea:disabled { opacity: .55; cursor: not-allowed; }
button:disabled { opacity: .5; cursor: not-allowed; }
a:hover { color: var(--gold-hover); }
.shell { grid-template-columns: 232px minmax(0, 1fr); }
.side { padding: 28px 16px 24px; }
.logo { padding: 0 8px 26px; gap: 12px; color: var(--text); }
.logo:hover { color: var(--text); }
.logo-mark { width: 36px; height: 36px; border: 1px solid var(--gold); border-radius: 10px; background: transparent; color: var(--gold); font: 23px Georgia, serif; }
.logo strong { font-size: 17px; font-weight: 550; letter-spacing: .015em; }
.logo strong b { color: var(--gold); font-weight: 500; }
.logo small { display: block; margin-top: 2px; font-size: 11px; letter-spacing: .1em; }
.nav-label { margin: 24px 12px 9px; color: #858892; font-size: 11px; letter-spacing: .08em; }
.nav-list { gap: 4px; }
.nav-list button { min-height: 42px; padding: 10px 12px; gap: 11px; border: 1px solid transparent; }
.nav-list button:hover { background: rgba(255,255,255,.035); color: var(--text); }
.nav-list button.active { border-color: rgba(212,163,86,.18); background: var(--gold-soft); color: var(--gold-hover); }
.workspace { padding-bottom: 32px; }
.topbar { height: 68px; padding: 0 32px; background: rgba(13,15,19,.95); backdrop-filter: blur(16px); }
.crumb { font-size: 12px; letter-spacing: .02em; }
.top-user { gap: 12px; font-size: 12px; }
.avatar { background: var(--gold-soft); border: 1px solid rgba(212,163,86,.28); color: var(--gold-hover); width: 30px; height: 30px; }
.page-head { padding: 32px 32px 0; align-items: center; }
.page-head h2 { font-size: 26px; line-height: 1.3; font-weight: 550; letter-spacing: .01em; }
.page-head .hint { margin-top: 8px; font-size: 13px; }
.stats, .dash-grid, .wallet-summary { padding: 24px 32px 0; gap: 20px; }
.filters { padding: 0 32px; margin-top: 24px; }
.panel, .card { margin: 24px 32px 0; padding: 24px; border: 1px solid var(--line); border-radius: 12px; }
.card { width: auto; }
.metric { padding: 22px 24px; border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.metric strong { font-size: clamp(24px, 2.4vw, 34px); line-height: 1.2; font-weight: 550; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; letter-spacing: -.025em; }
.metric strong small { font-size: 11px; color: var(--muted); letter-spacing: 0; }
.metric i { width: 3px; height: 32px; opacity: .8; }
.panel h3 { font-size: 15px; font-weight: 550; }
.panel > .hint { font-size: 12px; line-height: 1.8; }
.wallet-summary { grid-template-columns: minmax(220px, .9fr) repeat(2, minmax(0, 1fr)); align-items: stretch; }
.wallet-summary > .metric { flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 30px; background: radial-gradient(ellipse at 0 0, rgba(212,163,86,.09), transparent 80%), var(--surface); }
.wallet-summary > .metric::before { content: "USD / WALLET"; color: var(--gold); font-size: 10px; letter-spacing: .16em; }
.wallet-summary > .metric strong { font-size: 42px; margin: 14px 0 8px; }
.wallet-summary > .metric small { color: var(--muted); font-size: 12px; }
.wallet-summary .panel { display: flex; flex-direction: column; min-width: 0; }
.wallet-form { display: flex; flex-direction: column; flex: 1; gap: 12px; }
.wallet-form label { font-size: 12px; }
.wallet-form .primary { margin-top: auto; min-height: 42px; }
input, select, textarea { max-width: 100%; min-width: 0; }
.wallet-form input, .filters input, .filters select, .dialog input, .dialog select, .auth input {
  background: var(--bg); border-radius: 7px; min-height: 40px;
}
.dialog input[type=checkbox], .dialog input[type=radio] { min-height: auto; flex: none; }
.primary, .ghost, .danger { min-height: 36px; border-radius: 7px; font-size: 12px; font-weight: 550; }
.primary { color: #17130d; background: var(--gold); border-color: var(--gold); }
.primary:hover:not(:disabled) { background: var(--gold-hover); border-color: var(--gold-hover); }
.ghost { background: transparent; color: var(--text); }
.ghost:hover:not(:disabled), .copy-icon:hover { background: var(--surface-2); border-color: rgba(212,163,86,.45); }
.danger { background: rgba(226,108,105,.06); border-color: rgba(226,108,105,.3); }
.danger:hover:not(:disabled) { background: rgba(226,108,105,.14); }
.text-btn { font-size: 12px; }
.pill { padding: 3px 9px; font-size: 11px; border: 1px solid transparent; }
.pill.ok { border-color: rgba(85,214,155,.15); }
.pill.warn { border-color: rgba(231,183,75,.2); }
.pill.bad { border-color: rgba(226,108,105,.2); }
.card:has(> table), .panel:has(> table) { overflow-x: auto; }
th { background: rgba(255,255,255,.025); white-space: nowrap; font-size: 11px; }
td { font-size: 12px; overflow-wrap: anywhere; }
th, td { padding: 14px 12px; }
tbody tr:hover { background: rgba(255,255,255,.018); }
td .muted { margin-top: 4px; font-size: 11px; }
td .ghost { margin: 3px 2px; white-space: nowrap; }
code { color: #dfc79f; font-size: 11px; }
pre { line-height: 1.8; color: #d5d5da; background: var(--bg); border: 1px solid var(--line); overflow-wrap: anywhere; }
.empty { padding: 46px 16px; font-size: 13px; }
.err:not(:empty) { margin: 16px 32px 0; padding: 12px 14px; border: 1px solid rgba(226,108,105,.2); border-radius: 8px; background: rgba(226,108,105,.06); overflow-wrap: anywhere; }
.mask { background: rgba(0,0,0,.72); backdrop-filter: blur(5px); overflow-y: auto; }
.dialog { border: 1px solid rgba(212,163,86,.22); border-radius: 14px; padding: 28px; max-height: calc(100dvh - 40px); overflow: auto; }
.dialog h2 { font-size: 21px; font-weight: 550; }
.dialog .hint { font-size: 12px; line-height: 1.8; }
.dialog .actions { gap: 10px; margin-top: 24px; }
.dialog .err, .auth .err { margin: 12px 0 0; }
.quick-cycles button.active { color: var(--gold-hover); }
.check-row, .equity-limits section, .template-fields { background: rgba(255,255,255,.015); }
.check-row { font-size: 12px; }
.check-row small { line-height: 1.7; }
.key { background: var(--bg); border: 1px solid var(--line); color: var(--gold-hover); }
.auth { width: min(440px, calc(100% - 32px)); margin: 10vh auto 32px; padding: 36px; border: 1px solid rgba(212,163,86,.25); border-radius: 14px; }
.auth .brand { display: flex; align-items: center; gap: 12px; margin-bottom: 32px; font-size: 18px; }
.auth h1 { font-size: 24px; font-weight: 550; }
.auth > .muted { font-size: 12px; line-height: 1.8; }
.auth label, .dialog label { color: #c0c0c7; font-size: 12px; }
.auth .primary { width: 100%; margin-top: 16px; min-height: 42px; }
.auth-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; font-size: 12px; }
.auth-footer a { color: var(--muted); }
.auth-footer a:hover { color: var(--gold); }
@media (max-width: 1200px) {
  .wallet-summary { grid-template-columns: 1fr 1fr; }
  .wallet-summary > .metric { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; }
  .wallet-summary > .metric strong { font-size: 34px; }
}
@media (max-width: 980px) {
  .shell { display: block; }
  .side { padding: 18px 20px 12px; }
  .logo { padding-bottom: 16px; }
  .nav-groups { gap: 4px; }
  .nav-list { flex: none; }
  .nav-list button { white-space: nowrap; min-height: 40px; }
  .topbar { padding: 0 24px; height: 60px; }
  .stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .dash-grid { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 600px) {
  .side { padding: 16px 12px 10px; }
  .logo { padding: 0 4px 16px; }
  .topbar { position: static; min-height: 60px; height: auto; padding: 14px 16px; flex-wrap: wrap; gap: 12px; }
  .top-user { gap: 10px; flex-wrap: wrap; }
  .top-user > span:not(.avatar) { max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .page-head { padding: 24px 16px 0; align-items: flex-start; }
  .page-head h2 { font-size: 23px; }
  .stats, .dash-grid, .wallet-summary { padding: 18px 16px 0; gap: 12px; }
  .wallet-summary { grid-template-columns: minmax(0,1fr); }
  .wallet-summary > .metric { flex-direction: column; align-items: flex-start; gap: 20px; }
  .wallet-summary .panel { padding: 20px; }
  .metric { padding: 18px; }
  .metric strong { font-size: 26px; }
  .metric > i { display: none; }
  .panel, .card { margin: 18px 16px 0; padding: 18px; }
  .filters { padding: 0 16px; margin-top: 18px; }
  .filters input { min-width: 0; width: 100%; }
  .filters select { flex: 1; }
  .mix { flex-wrap: wrap; gap: 16px; }
  .mix-legend { min-width: 140px; }
  .mask { padding: 12px; }
  .dialog { padding: 20px; max-height: calc(100dvh - 24px); }
  .dialog .grid { grid-template-columns: minmax(0,1fr); }
  .dialog .actions { flex-wrap: wrap; }
  .credential-stack { min-width: 220px; }
  .generated-product-key { grid-template-columns: minmax(0,1fr) auto; }
  .generated-product-key > span { grid-column: 1 / -1; }
  .generated-product-key small { grid-column: 1 / -1; }
  .auth { padding: 28px 24px; margin-top: 6vh; }
  .err:not(:empty) { margin: 16px; }
  .dialog .err, .auth .err { margin: 12px 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
