:root {
  color-scheme: light;
  font: 16px/1.55 "Inter", "Microsoft YaHei", system-ui, sans-serif;
  color: #182436;
  background: #f2f5f9;
  --line: #dce4ef;
  --accent: #174aa6;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid #a34d00; outline-offset: 3px; }
h1, h2, p { margin: 0 0 .8rem; }
h1 { font-size: 1.85rem; }
h2 { font-size: 1.15rem; }
form { margin: 0; }
button, input, select { font: inherit; min-width: 0; }
button, a, input, select { touch-action: manipulation; }
button { min-height: 44px; border: 1px solid transparent; background: var(--accent); color: white;
  border-radius: 8px; padding: .45rem .85rem; cursor: pointer; }
.quiet { background: #edf3fc; color: #143c84; border-color: var(--line); }
.top { display: flex; gap: .75rem; align-items: center; padding: .7rem 1.25rem; background: #101d32; color: white; }
.top strong { letter-spacing: .06em; font-size: 1.25rem; }
.top form { margin-left: auto; }
.layout { display: grid; grid-template-columns: 10rem minmax(0, 1fr) minmax(16rem, 27%);
  gap: 1.15rem; max-width: 1560px; margin: auto; padding: 1.2rem; }
nav, main, aside { min-width: 0; overflow-wrap: anywhere; }
nav { display: flex; flex-direction: column; gap: .4rem; }
nav a, .target, .section-title a { display: flex; align-items: center; min-height: 44px; padding: .45rem .7rem;
  border-radius: 8px; text-decoration: none; }
[aria-current] { background: #e2edff; font-weight: 700; }
.card, aside, .login { padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: white; }
.card { margin-bottom: .9rem; }
aside { align-self: start; }
.section-title, .target, .account { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; }
.section-title h2 { margin: 0; }
.target { border: 1px solid var(--line); margin-top: .5rem; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
label { display: block; }
input:not([type=checkbox]), select { display: block; width: 100%; min-height: 44px; margin-top: .25rem;
  padding: .4rem .55rem; color: inherit; background: white; border: 1px solid #8192a9; border-radius: 6px; }
input[readonly] { background: #f2f5f9; }
fieldset { min-width: 0; border: 1px solid var(--line); border-radius: 8px; margin: .75rem 0; }
.options, .actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.options label, .log-filter { display: flex; gap: .35rem; align-items: center; min-height: 44px; }
.actions, .review label, .login label { margin-bottom: .8rem; }
.notice { border-left: 4px solid #a34d00; padding: .65rem; background: #fff1de; }
#events { height: min(56vh, 31rem); overflow: auto; padding: .6rem 1rem; margin: 0; list-style: none;
  background: #132039; color: #edf4ff; border-radius: 8px; font-size: .875rem; }
#events li + li { margin-top: .5rem; }
.login { max-width: 25rem; margin: 12vh auto 0; }
#toggle-logs { display: none; }
@media (max-width: 760px) {
  .layout { display: block; padding: .75rem; }
  nav { flex-direction: row; flex-wrap: wrap; margin-bottom: .75rem; }
  nav a { padding-inline: .5rem; }
  #toggle-logs { display: inline-block; }
  #logs { display: none; }
  .show-logs #logs { display: block; }
  .show-logs #workspace { display: none; }
  .fields { grid-template-columns: minmax(0, 1fr); }
  .login { margin: 8vh .75rem 0; }
}

.layout { width: 100%; max-width: none; }
.target-info { border-bottom: 1px solid var(--line); padding: .5rem 0; }
.target-info summary { cursor: pointer; min-height: 44px; }
.target-info small { display: block; }
#terminal-progress { max-height: 28vh; overflow: auto; white-space: pre-line; }
#theme-switch { position: fixed; top: .7rem; right: 5rem; z-index: 2; }
#divider { display: none; }
@media (min-width: 840px) {
  body:has(.layout) { display: grid; height: 100dvh; grid-template-rows: auto minmax(0, 1fr); }
  .layout { margin: 0; min-height: 0; padding: .8rem 0; gap: 0;
    grid-template-columns: 160px minmax(360px, 1fr) 12px clamp(260px, var(--terminal-width, 35%), calc(100% - 532px)); }
  .layout > nav, .layout > main { overflow: auto; padding-inline: .65rem; }
  #logs { align-self: stretch; display: flex; flex-direction: column; min-height: 0; margin-right: .6rem; }
  #events { flex: 1; height: auto; min-height: 0; }
  #divider { display: block; cursor: col-resize; touch-action: none; border-inline: 4px solid transparent; background: var(--line); background-clip: content-box; }
}
@media (max-width: 839px) {
  .layout { display: block; padding: .75rem; }
  nav { flex-direction: row; flex-wrap: wrap; margin-bottom: .75rem; }
  #toggle-logs { display: inline-block; }
  #logs { display: none; }
  .show-logs #logs { display: block; }
  .show-logs #workspace { display: none; }
}
:root[data-theme=dark] { color-scheme: dark; background: #101827; color: #ebf1fa; --line: #43546e; --accent: #255bb7; }
[data-theme=dark] :is(.card, aside, .login, input:not([type=checkbox]), select) { background: #18263a; color: #ebf1fa; }
[data-theme=dark] :is(.quiet, [aria-current], .notice) { background: #233651; color: #ebf1fa; }
[data-theme=dark] a { color: #a9ccff; }
[data-theme=dark] :focus-visible { outline-color: #ffba74; }
