*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: monospace; background: #f5f5f3; color: #1a1a1a; }

/* ── Layout ── */
#app { display: flex; flex-direction: column; height: 100vh; }

/* ── Topbar ── */
#topbar {
  flex: none; height: 48px;
  display: flex; align-items: center; gap: 10px; padding: 0 14px;
  background: #fff; border-bottom: 1px solid #e5e5e5;
}
#topbar h1 { font-size: 14px; font-weight: 600; color: #0F6E56; white-space: nowrap; letter-spacing: 0.04em; }
#status-dot { width: 7px; height: 7px; border-radius: 50%; background: #ddd; flex: none; transition: background .3s; }
#status-dot.ready { background: #1D9E75; }
#status-dot.error { background: #e24b4a; }
#newick-input {
  flex: 1; font-family: monospace; font-size: 12px;
  padding: 5px 8px; border: 1px solid #e0e0e0; border-radius: 4px; background: #fafafa;
  color: #1a1a1a;
}
#newick-input:focus { outline: none; border-color: #1D9E75; }
.btn {
  font-family: monospace; font-size: 12px; padding: 5px 14px;
  border: 1px solid #ddd; border-radius: 4px; background: #fff;
  cursor: pointer; white-space: nowrap; color: #333;
}
.btn:hover:not(:disabled) { background: #f5f5f5; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-run { background: #0F6E56; color: #E1F5EE; border-color: #0F6E56; }
.btn-run:hover:not(:disabled) { background: #0d5e48; }

/* ── Workspace ── */
#workspace { flex: 1; display: flex; min-height: 0; }

/* ── Left column (output area) ── */
#left-col { flex: 1; display: flex; flex-direction: column; min-height: 0; min-width: 0; }

/* ── Right panel ── */
#panel {
  flex: none; width: 290px; border-left: 1px solid #e5e5e5;
  overflow-y: auto; background: #fafafa; display: flex; flex-direction: column;
}
#panel-content { display: flex; flex-direction: column; }

.psec { padding: 12px 14px; border-bottom: 1px solid #ebebeb; }
.psec:last-child { border-bottom: none; }
.plabel { font-size: 10px; color: #aaa; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 7px; }
.pname { font-size: 14px; font-weight: 600; color: #1a1a1a; }
.pmeta { font-size: 11px; color: #999; margin-top: 3px; line-height: 1.5; }

.sec-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.sec-title { font-size: 10px; font-weight: 600; color: #555; letter-spacing: 0.07em; text-transform: uppercase; }

/* Toggle */
.tog { position: relative; width: 30px; height: 17px; cursor: pointer; flex: none; }
.tog input { opacity: 0; width: 0; height: 0; position: absolute; }
.tog-track { position: absolute; inset: 0; border-radius: 9px; background: #ddd; transition: background .15s; }
.tog input:checked + .tog-track { background: #0F6E56; }
.tog-thumb { position: absolute; top: 2.5px; left: 2.5px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: left .15s; pointer-events: none; }
.tog input:checked ~ .tog-thumb { left: 15.5px; }

/* Fields */
.field { margin-bottom: 8px; }
.field:last-child { margin-bottom: 0; }
.field > label { display: block; font-size: 10px; color: #aaa; margin-bottom: 3px; }
.field select, .field input[type=number] {
  width: 100%; font-family: monospace; font-size: 12px;
  padding: 4px 7px; border: 1px solid #e0e0e0; border-radius: 4px;
  background: #fff; color: #1a1a1a;
}
.field select:focus, .field input:focus { outline: none; border-color: #1D9E75; }

/* Multi-input rows (e.g. model parameters: frequencies, rate params) */
.field-row { display: flex; gap: 6px; margin-bottom: 8px; }
.field-row:last-child { margin-bottom: 0; }
.field-row-item { flex: 1; min-width: 0; }
.field-row-item > label { display: block; font-size: 10px; color: #aaa; margin-bottom: 3px; }
.field-row-item input[type=number] {
  width: 100%; font-family: monospace; font-size: 12px;
  padding: 4px 5px; border: 1px solid #e0e0e0; border-radius: 4px;
  background: #fff; color: #1a1a1a;
}
.field-row-item input:focus { outline: none; border-color: #1D9E75; }

/* ── Output panel ── */
#output-panel {
  flex: 1; display: flex; flex-direction: column; min-height: 0;
}
#out-header {
  flex: none; height: 36px; display: flex; align-items: center; gap: 8px;
  padding: 0 14px; background: #fff; border-bottom: 1px solid #ebebeb;
}
#out-label { font-size: 11px; font-weight: 600; flex: 1; color: #333; }
#out-body {
  flex: 1; overflow-y: auto; padding: 10px 14px;
  font-family: monospace; font-size: 11px; line-height: 1.55;
  white-space: pre; color: #333; background: #f5f5f3;
}
