:root {
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #202927;
  background: #f5f7f5;
  --surface: #fff;
  --border: #d8e0db;
  --muted: #535e59;
  --accent: #175d47;
  --accent-hover: #124936;
  --selection: #eaf4ee;
  --danger: #902e2a;
  --radius: 7px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button:disabled { cursor: wait; opacity: .66; }
:focus-visible { outline: 3px solid #267459; outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.65rem, 3vw, 2rem); letter-spacing: -.035em; line-height: 1.16; }
h2 { font-size: 1.05rem; letter-spacing: -.01em; line-height: 1.35; }
.muted { color: var(--muted); }

.topbar { background: #192b25; color: #f4f8f5; }
.topbar-inner, .page { width: min(100%, 72rem); margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2.25rem); }
.topbar-inner { min-height: 4rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: .55rem; }
.wordmark { font-size: 1.01rem; font-weight: 700; letter-spacing: -.02em; }
.session { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.session-username { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #d2ddd6; font-size: .9rem; }
.page { padding-block: clamp(1.35rem, 5vw, 3.25rem); }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.25rem; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.65rem;
  padding: .55rem .88rem;
  border: 1px solid #a1afa7;
  border-radius: var(--radius);
  background: var(--surface);
  color: #22332a;
  font-size: .91rem;
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
}
.button:hover:not(:disabled) { background: #edf3ef; border-color: #7e9186; }
.button-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.button-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.button-wide { width: 100%; }
.button-danger { color: var(--danger); border-color: #d6b3b0; }
.button-danger:hover:not(:disabled) { color: #71211e; background: #fff2f0; border-color: #b67a74; }
.button-link { background: transparent; color: var(--accent); border-color: transparent; padding-inline: 0; text-decoration: underline; text-underline-offset: .15em; }
.button-link:hover:not(:disabled) { background: transparent; border-color: transparent; color: var(--accent-hover); }
.button-quiet { color: #f4f8f5; background: transparent; border-color: #596e63; white-space: nowrap; }
.button-quiet:hover:not(:disabled) { background: #30473b; color: #fff; border-color: #9fb3a8; }
.topbar :focus-visible { outline-color: #a1dec0; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; }
.panel-heading { padding: .9rem 1.15rem; border-bottom: 1px solid var(--border); }
.panel-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; padding: .9rem 1.15rem; }
.panel-body, .panel-message { padding: 1.1rem 1.15rem; }
.panel-message { line-height: 1.5; }
.access { width: min(100%, 27rem); margin: clamp(.25rem, 4vw, 2.75rem) auto 0; padding: clamp(1.1rem, 5vw, 2rem); }
.access > .muted { margin-top: .65rem; line-height: 1.5; }
.access form { margin-block: 1.5rem .35rem; }
.flow { display: grid; gap: 1.05rem; }
.field { display: grid; gap: .38rem; min-width: 0; }
.field > span { font-size: .88rem; font-weight: 650; }
.field input, .field select, .field textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 2.65rem;
  padding: .53rem .64rem;
  color: #202927;
  background: var(--surface);
  border: 1px solid #a1afa7;
  border-radius: var(--radius);
}
.field input:hover, .field select:hover, .field textarea:hover { border-color: #72877a; }
.field small { font-size: .81rem; line-height: 1.4; }
.status { color: var(--muted); font-size: .93rem; }
.alert { border: 1px solid #e1b6b0; border-radius: var(--radius); padding: .68rem .8rem; background: #fff2ef; color: #792421; line-height: 1.4; overflow-wrap: anywhere; }
.workspace > .status, .workspace > .alert { margin-bottom: 1rem; }
.profile-layout { display: grid; grid-template-columns: minmax(13rem, 1fr) minmax(0, 2.6fr); gap: 1rem; align-items: start; }
.profile-list { list-style: none; margin: 0; padding: .36rem; max-height: 25rem; overflow-y: auto; }
.profile-list:empty { display: none; }
.profile-list button { display: block; width: 100%; padding: .72rem .8rem; border: 1px solid transparent; border-radius: calc(var(--radius) - 2px); background: transparent; text-align: left; color: inherit; cursor: pointer; overflow-wrap: anywhere; }
.profile-list button:hover { background: #f1f5f2; }
.profile-list button[aria-current="true"] { background: var(--selection); color: #134b38; border-color: #bbd6c5; font-weight: 650; }
.profile-list button:focus-visible { outline-offset: -2px; }
.setting-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem 1.3rem; }
.setting-flag { display: flex; gap: .58rem; align-items: center; font-size: .94rem; min-height: 2rem; }
.setting-flag input { width: 1.15rem; height: 1.15rem; margin: 0; accent-color: var(--accent); }
.simulation { display: grid; grid-template-columns: minmax(0, 16rem) auto; align-items: end; justify-content: start; gap: .6rem .8rem; padding: .9rem 1.15rem 1.1rem; border-top: 1px solid var(--border); }
.simulation .muted, .simulation .alert { grid-column: 1 / -1; font-size: .85rem; }
.history { margin-top: 1.25rem; }
.run + .run { border-top: 1px solid var(--border); }
.run summary { padding: .82rem 1.15rem; cursor: pointer; }
.run summary:hover { background: #f2f6f3; }
.run summary:focus-visible { outline-offset: -4px; }
.run-summary { display: inline-grid; width: calc(100% - 1.4rem); grid-template-columns: minmax(0, 1fr) minmax(6rem, .45fr) minmax(9rem, .6fr); gap: .6rem; align-items: baseline; padding-inline-start: .35rem; vertical-align: middle; }
.run-summary > * { overflow-wrap: anywhere; }
.run-summary time { text-align: end; font-size: .88rem; }
.run-details { margin: 0 1.15rem 1rem; padding: .8rem 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: #f8faf8; line-height: 1.5; overflow-wrap: anywhere; }
.run-details ul { margin: .5rem 0; padding-inline-start: 1.15rem; }
.run-details dl { display: grid; grid-template-columns: auto 1fr; gap: .2rem .75rem; margin: .5rem 0 0; }
.run-details dt { font-weight: 650; }
.run-details dd { margin: 0; }
dialog { width: min(calc(100% - 2rem), 26rem); padding: 0; border: 1px solid var(--border); border-radius: var(--radius); color: inherit; }
dialog::backdrop { background: rgb(21 33 27 / 50%); }
dialog .panel-actions { justify-content: flex-end; }

@media (max-width: 43rem) {
  .profile-layout { grid-template-columns: 1fr; }
  .profile-list { max-height: 13rem; }
}
@media (max-width: 29rem) {
  .topbar-inner, .session { gap: .55rem; }
  .session-username { max-width: 6rem; }
  .simulation, .setting-grid { grid-template-columns: minmax(0, 1fr); justify-content: stretch; }
  .run-summary { grid-template-columns: minmax(0, 1fr) auto; }
  .run-summary time { grid-column: 1 / -1; text-align: start; }
}
